From patchwork Thu Jun 3 11:09:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453248 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp173849jao; Thu, 3 Jun 2021 04:10:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7+RH43Ji3h/svCnZGzS26P7W3P3OR4Ix9ozH3bK7J641ezBc8kdn+CCYPxx1BBl/J+Y1m X-Received: by 2002:a17:906:2f91:: with SMTP id w17mr39176701eji.443.1622718601563; Thu, 03 Jun 2021 04:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622718601; cv=none; d=google.com; s=arc-20160816; b=b6IT3vFJBYK+0tiH6/ZIlWrmgorxIVN4/zUEX39yyPy1NVQerCTyT6K9rtXRDw1TeM 5Xjjm5mL3vMZ1bODBglfvKCAAar/eEH99vnesNClhyKGv9eqs7C1We7T4iMyXont14CX KoJ+AbioZjcJAAsiOfrgqyKITs6YzMcqY5YoYBQycCHShHHa4TzvFZ6MeLyj7PvrpHMM v+64g0dzoDE0fp13d6pKBSLBf4cvGmtTzULbFOoR+rBO25MdZH8Wo9b9BL8YnjXJOJEP +C83bAQpdcjo+uLprlWV5UUSyruWbEjnj8tK5XR9pASVnKVvoVgZoZNvzjTHxI+uRZ++ rPpA== 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=cqd7pLXWn6/Ph0fVpb7/vTB20bkg4II6ymeft9Q9N/Q=; b=m1sEDVrKjT2moVQgXu/VZJlhUnA2h1CkVBC9AoNKxTmjJQOgolFsoLz5QaWqOqB+IO qaOavQ4WqAz2NOjF1NuCGBmlAZJ1UA88Tf6nLMbGFkDax9yvqIwDk9Dw+rGIFz47UU/s S+/MdExyJ7R0gODXz2KJ/pW2FCwgRE5rsBGlDmrsQ9GWri13zl+jRfeX8QPTwqH/5HV6 zGw/3etaHso/SRjGtbSXjHgt473l3Vn1uUAYYMfM9qJo7otm2OYXWCW2Io69VY2kntFx PJqzsI6IJlUoHY6lrehXEMtN7+2SaMxtVA64C9Vt0shCCA/fJDYyz52rxog7Nlxt8psM UOWw== 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 s13si2252800edr.28.2021.06.03.04.10.01; Thu, 03 Jun 2021 04:10:01 -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 S229980AbhFCLKz (ORCPT + 8 others); Thu, 3 Jun 2021 07:10:55 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3046 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbhFCLKy (ORCPT ); Thu, 3 Jun 2021 07:10:54 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FwjhR6jZLzWr77; Thu, 3 Jun 2021 19:04:23 +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 19:09:08 +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 19:09:07 +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 CC: Zhen Lei Subject: [PATCH 1/1] can: esd_usb2: use DEVICE_ATTR_RO() helper macro Date: Thu, 3 Jun 2021 19:09:02 +0800 Message-ID: <20210603110902.11930-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: dggems701-chm.china.huawei.com (10.3.19.178) 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_RO() 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/usb/esd_usb2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 65b58f8fc3287cd..60f3e0ca080afdb 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -474,7 +474,7 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) netif_trans_update(netdev); } -static ssize_t show_firmware(struct device *d, +static ssize_t firmware_show(struct device *d, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(d); @@ -485,9 +485,9 @@ static ssize_t show_firmware(struct device *d, (dev->version >> 8) & 0xf, dev->version & 0xff); } -static DEVICE_ATTR(firmware, 0444, show_firmware, NULL); +static DEVICE_ATTR_RO(firmware); -static ssize_t show_hardware(struct device *d, +static ssize_t hardware_show(struct device *d, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(d); @@ -498,9 +498,9 @@ static ssize_t show_hardware(struct device *d, (dev->version >> 24) & 0xf, (dev->version >> 16) & 0xff); } -static DEVICE_ATTR(hardware, 0444, show_hardware, NULL); +static DEVICE_ATTR_RO(hardware); -static ssize_t show_nets(struct device *d, +static ssize_t nets_show(struct device *d, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(d); @@ -508,7 +508,7 @@ static ssize_t show_nets(struct device *d, return sprintf(buf, "%d", dev->net_count); } -static DEVICE_ATTR(nets, 0444, show_nets, NULL); +static DEVICE_ATTR_RO(nets); static int esd_usb2_send_msg(struct esd_usb2 *dev, struct esd_usb2_msg *msg) {