Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp160528pxj; Thu, 20 May 2021 06:44:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR2G7VkMYf4JqNafpcqPENoymckgNkkrDdK0oaqo3Ksw57h5P30pgqcV4EB3l78XbZ/whX X-Received: by 2002:a05:6e02:1b8f:: with SMTP id h15mr5405690ili.151.1621518259223; Thu, 20 May 2021 06:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621518259; cv=none; d=google.com; s=arc-20160816; b=BygeeRl1r/CuYFcSnzsu8+9rD9aZsai4SH2+wrE5XtY/47hqJwAbk9znSpjmuVfQY/ XfW1F3SWZDfbM9q+OrNy4UkQG7tMjVRTyJmQSS00/3BaivqoXlUf9BGgFrRGJciOoCkb C+MVWUbvytIFZ2ujG3zyrZ3wZ631EesUePHarMXwiQFnos7n05mFOiFhYroNj8OZcw/t v3zme1IpsxDUcxJx5BJsEbgOXA3BaVGkdDL4NvaYOXDAmY/M+teLmGLeynWK2gJTdEZk xSPuj6qIKRcyVYeG2O5PNs4+6w1NIiPgUWYLYJNoPjix/0wMUrbtJ5kFxNx0eCciTZCf 9tFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=6fKuhEHzyruEIfSGl0sACMd3ZUw+oOOv5jETWcXdZ3k=; b=J4RO5ixbqUZ3Js54uUSzxwJoB7PJOzEdFWL/8DmyJgj0Py6zsAwI0J7dekocHbLxp5 dM2vDYbunGttnzFqd/uGhrNJfvZZkd7VS2QKlYqc1iwSBq4sFhAHNOgMvbJPGEWc33Vn H9EOo7yMy3qB4DypchXA17ue5TYRWQwzqxnaj+fm92CKPW0cCrGojcgNcQCqP139283c vSy4bECg/LnZGO82FiWTsl0YIXBCU3alBLfptKOYnwVJvngy2R1Wq6/SdXmJN44YEVDC 5LbYLX8vXaK6t8+ohxHBPYUGi0pumIAS2EadE6EbvNA30c6qd/B3AptRE66dj0EOmBGm I4lw== 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 y10si2450045jak.112.2021.05.20.06.44.04; Thu, 20 May 2021 06:44:19 -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 S241171AbhETNnX (ORCPT + 99 others); Thu, 20 May 2021 09:43:23 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:3447 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239378AbhETNmp (ORCPT ); Thu, 20 May 2021 09:42:45 -0400 Received: from dggems704-chm.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Fm9mp1rVQzBvJn; Thu, 20 May 2021 21:38:34 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems704-chm.china.huawei.com (10.3.19.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 20 May 2021 21:41:20 +0800 Received: from localhost (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 20 May 2021 21:41:19 +0800 From: YueHaibing To: , CC: , , , YueHaibing Subject: [PATCH net-next] net: usb: hso: use DEVICE_ATTR_RO macro Date: Thu, 20 May 2021 21:41:16 +0800 Message-ID: <20210520134116.36872-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- drivers/net/usb/hso.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 63e394cafc17..d84258c70d0c 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -457,9 +457,8 @@ static const struct usb_device_id hso_ids[] = { MODULE_DEVICE_TABLE(usb, hso_ids); /* Sysfs attribute */ -static ssize_t hso_sysfs_show_porttype(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t hsotype_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct hso_device *hso_dev = dev_get_drvdata(dev); char *port_name; @@ -505,7 +504,7 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev, return sprintf(buf, "%s\n", port_name); } -static DEVICE_ATTR(hsotype, 0444, hso_sysfs_show_porttype, NULL); +static DEVICE_ATTR_RO(hsotype); static struct attribute *hso_serial_dev_attrs[] = { &dev_attr_hsotype.attr, -- 2.17.1