From patchwork Thu Jun 3 10:02:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453242 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2b0d:0:0:0:0 with SMTP id gc13csp100240ejc; Thu, 3 Jun 2021 03:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9cMaTEtCP50gxIEwYQCOOXD8cJaoYncN866R3etF8kuISFKkFim5fUjff8uXOUT7FNYiO X-Received: by 2002:a17:906:2a8e:: with SMTP id l14mr25270051eje.549.1622714599167; Thu, 03 Jun 2021 03:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622714599; cv=none; d=google.com; s=arc-20160816; b=KmULuCbvjs+Ei44pSweE342gvKBB1lo/Ia2LHloANCYd6nF2JZRknm4LR0vapIIZQh UMVWtBPZLpAYwkx7B5zIpOLWtF6UDtdGfBrpUq3rhP/0/gtLsugPzhvqYzdBGCN/l697 3IXJ5iClXEpz7Gd29lbrroXt9lGKCVPtQsqehEbD2DCShT8EGyfH7uvc9ew95LL83yKF 0aLl+7vIvfoRv35Pr9B7UHewp9a4FSiFrk/J5KfEOnKaZ3WfJZl1hz2UzhOl8dYGnVGv cIuxpIgGlItEwms0hXDfSzIidSQBU9ZTr8VxfNqTO0rDW3sv17Pu+oHmqIbsgGoS1Ikt qENw== 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=ZJnTQslb4VAG3w2UMrrxGM8N1xKN7cNn4X5WvjeWkHI=; b=Qtqr/RLJ/5jI2n+ca/dxFx99ku0dLqUI+xwx8cY1qWiypxhl1sMILrrIcYPxJCo9zC 1HyAYB9K3GJXvGwHvZhNpldXvwGH9WVNBWPqu+MwcokiiRBDM7+JJEO4VnsDawFp18I+ 6mW5Ob24HTcNIFU7bVp7z6XAZmDJGY7cZwy8ZpEVNrIvEDTJ/yXD1r5S2n1qbKt3ikmy WHTN+t79Lg0LeHAIEnfFD0+ANgawb9+FfHHQ34BRd0NzeDh2lKmigNHWa9PmzAjVeZst 6t44jvWeFSChZZXha9etW58qRhGe02rw4nHEYZFXMXvmusO2Z29Q4kjCQr9I6QnfvHgP d5xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 m16si1412830ejn.684.2021.06.03.03.03.18; Thu, 03 Jun 2021 03:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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 netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S229839AbhFCKEn (ORCPT + 8 others); Thu, 3 Jun 2021 06:04:43 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7088 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhFCKEm (ORCPT ); Thu, 3 Jun 2021 06:04:42 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FwhGM2hmkzYqN9; Thu, 3 Jun 2021 18:00:11 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv711-chm.china.huawei.com (10.1.198.66) 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 18:02:44 +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 18:02:43 +0800 From: Zhen Lei To: Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , "Jakub Kicinski" , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , linux-can , netdev , linux-arm-kernel , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] can: at91_can: use DEVICE_ATTR_RW() helper macro Date: Thu, 3 Jun 2021 18:02:33 +0800 Message-ID: <20210603100233.11877-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: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use DEVICE_ATTR_RW() helper macro instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/net/can/at91_can.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 04d0bb3ffe89661..ca736b26e218ca4 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -1176,8 +1176,8 @@ static const struct net_device_ops at91_netdev_ops = { .ndo_change_mtu = can_change_mtu, }; -static ssize_t at91_sysfs_show_mb0_id(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t mb0_id_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct at91_priv *priv = netdev_priv(to_net_dev(dev)); @@ -1187,8 +1187,8 @@ static ssize_t at91_sysfs_show_mb0_id(struct device *dev, return snprintf(buf, PAGE_SIZE, "0x%03x\n", priv->mb0_id); } -static ssize_t at91_sysfs_set_mb0_id(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) +static ssize_t mb0_id_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { struct net_device *ndev = to_net_dev(dev); struct at91_priv *priv = netdev_priv(ndev); @@ -1222,7 +1222,7 @@ static ssize_t at91_sysfs_set_mb0_id(struct device *dev, return ret; } -static DEVICE_ATTR(mb0_id, 0644, at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id); +static DEVICE_ATTR_RW(mb0_id); static struct attribute *at91_sysfs_attrs[] = { &dev_attr_mb0_id.attr,