From patchwork Thu Jun 3 07:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453224 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp37964jao; Thu, 3 Jun 2021 00:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt9vXS42pDPs3HUNcDR+RIu+fTia2E0bqI4M8EmHJjqq3Pe1I0RR94BProz/dKJd1wDwHa X-Received: by 2002:a17:906:944a:: with SMTP id z10mr14627105ejx.224.1622704716519; Thu, 03 Jun 2021 00:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622704716; cv=none; d=google.com; s=arc-20160816; b=LD4Yg9FBjHDHMjR03kWIixFxVPiXktt1T/b1HW+mniHnz+VIBRNrXoE1TFji2+Q1m8 2GelAn29B7wQ1zfywSHQLynUoHvL3MHM0k9kr73WRkiJS6uTAgG2FGbPkFNUTdJt+B/p x99mDfVqQNMYS9yO3CFInng4YpyEU6ONDZqQCJAwEJ0oJJsaVFhLxq5QESNOj18GYOEJ w/rx6V1U4vyl3eMShhyKZnlVENUUlDk7RJH/a0mdCL6dqjK2i0ojIQj0i/w7uz7va+vY uQ17eO5OKFOuXCQgiZjqSIJ8GlB+ALS4f3s+M5JNGD8XMGGUALhkb+JZcSy+GDypWWBV xwUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Kd+CY6kiRlLyy7/cQqbjYE4N29GohOK9yyiJGTqIVW4=; b=0FtzoXzIhuB+QUccAK6U9NwLnDnUVar+J/J5zSI/hO1LW+ATyzAVjHI+fvCHXSDMUn Th1SMqd/RIrp06uqVH6Hi7k1dRBSCFYMVrIqvnQBsKQB7pKRMoe9NTTdr+qEK8AKuOVv Z2QFMpxbUfLPf00JNOBp134sOFPu/5PwJPrzIvZz0r+WFxr95fNwhXPZJe6WAxZFwOZ/ zQFPSAzNIvIU6FcGUEqTJtCRt4vuZ/WPcy1h15X6iHk+3ofyW5sjkdZc73gtd4Bso6w+ dZWp/PaWebzxbJNNCrcvGV1a1J4VkQJeeWI47nDxO6OdM2RI6DNNdOgmN3vL5S5MO+Gt /cTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si1721663ejc.443.2021.06.03.00.18.36; Thu, 03 Jun 2021 00:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhFCHTm (ORCPT + 4 others); Thu, 3 Jun 2021 03:19:42 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7080 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbhFCHTm (ORCPT ); Thu, 3 Jun 2021 03:19:42 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fwcby58nNzYq8j; Thu, 3 Jun 2021 15:15:10 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 15:17:55 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 15:17:55 +0800 From: Zhen Lei To: Sakari Ailus , Mauro Carvalho Chehab , linux-media CC: Zhen Lei Subject: [PATCH 1/1] media: i2c: use DEVICE_ATTR_RO() helper macro Date: Thu, 3 Jun 2021 15:17:50 +0800 Message-ID: <20210603071750.11594-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use DEVICE_ATTR_RO() helper macro instead of DEVICE_ATTR(), which is simpler and more readable. Due to the name of the read function of the sysfs attribute is normalized, there is a natural association. Signed-off-by: Zhen Lei --- drivers/media/i2c/ccs/ccs-core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index a349189a38dbb9c..de47670dac78c24 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -2669,8 +2669,7 @@ static int ccs_get_skip_top_lines(struct v4l2_subdev *subdev, u32 *lines) */ static ssize_t -ccs_sysfs_nvm_read(struct device *dev, struct device_attribute *attr, - char *buf) +nvm_show(struct device *dev, struct device_attribute *attr, char *buf) { struct v4l2_subdev *subdev = i2c_get_clientdata(to_i2c_client(dev)); struct i2c_client *client = v4l2_get_subdevdata(subdev); @@ -2700,11 +2699,10 @@ ccs_sysfs_nvm_read(struct device *dev, struct device_attribute *attr, */ return rval; } -static DEVICE_ATTR(nvm, S_IRUGO, ccs_sysfs_nvm_read, NULL); +static DEVICE_ATTR_RO(nvm); static ssize_t -ccs_sysfs_ident_read(struct device *dev, struct device_attribute *attr, - char *buf) +ident_show(struct device *dev, struct device_attribute *attr, char *buf) { struct v4l2_subdev *subdev = i2c_get_clientdata(to_i2c_client(dev)); struct ccs_sensor *sensor = to_ccs_sensor(subdev); @@ -2719,8 +2717,7 @@ ccs_sysfs_ident_read(struct device *dev, struct device_attribute *attr, minfo->smia_manufacturer_id, minfo->model_id, minfo->revision_number) + 1; } - -static DEVICE_ATTR(ident, S_IRUGO, ccs_sysfs_ident_read, NULL); +static DEVICE_ATTR_RO(ident); /* ----------------------------------------------------------------------------- * V4L2 subdev core operations