Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp144584pxj; Thu, 3 Jun 2021 03:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtRgmz6s250q6EGHYhKt+qensyp6Sc2/PA56l5i2T18Ysi7CiLP5E6J7o1/t55iy+OVCTT X-Received: by 2002:a17:907:9607:: with SMTP id gb7mr1345747ejc.208.1622714841518; Thu, 03 Jun 2021 03:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622714841; cv=none; d=google.com; s=arc-20160816; b=1Gwx0PiaoDlpyIZ60qyWWbfZdPz1XZT+l299dzPjw3uzaL4bNzv2GO4tBXOWPRpF8u q6kh9UfGwFoMo8UJ6vplQcwTNBxjTY//MW/oq/82T9POSCAFhTSU0MDvNvbo9k8nVFe4 PPp9P2IYuH08QZQNuBXDv4V9XhRuy1fOfWMM4yQhiqT0QDclG/zQRRCBbBrcMz+PNjM0 rhxOfGpsXWsH82lHOXmSU45RTGBKKCiQlXMqO+EPbY008m4/9TiN8qVveQ+G7fHlWhY3 5dNzGaR3RfTIS/Acpi2RTiNJm8IFLoPMPcxMYx/ta0g9lu8iRRmrwbHH0JpSprO1B9N1 x/KQ== 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=SUj5z8cTKC27OMjZ95vIPBoKOvYInt8ZC0BtZ5VXZisVtqbl4+ulD2qC8nOt4kw1B5 iUaUNWqBjOd6BElZCf4cdYdNb2gL/gMssYvVfp51RZ+f+v2fwMAAbVIdvqwHCM5sswBj 23U1fTqhXlnKcWLogvE1+KEVGytVQb7wOoq56dz+nTooSjfj/wvnvRPKEgKY/ynXlM8L U6QmCeQCJ93GsXKyo0rTG/ESVS0F4K6JD/VQWNKHkqrqkLLyZtQimKv/hDtfnZMDDcLq Fc9qQ1N9j5vclftewoGkvY08qzymUsE5mTTeGALCuVi4WDpV46e/siDAR4FO4rg5ANr2 eOKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 h21si1759765ejt.172.2021.06.03.03.06.58; Thu, 03 Jun 2021 03:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S229825AbhFCKEn (ORCPT + 99 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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: linux-kernel@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(-) 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, -- 2.26.0.106.g9fadedd