From patchwork Wed Jun 2 08:15:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 452480 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp359825jao; Wed, 2 Jun 2021 01:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTdyqskIJYmg0tzXisJdegYfEQe38h9tija4VvlVcuwSw/LgOT4QNISC33E2+d50bz9r3d X-Received: by 2002:a92:7d07:: with SMTP id y7mr25295857ilc.68.1622621759724; Wed, 02 Jun 2021 01:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622621759; cv=none; d=google.com; s=arc-20160816; b=0jm//2MTrxIAs/ly1CL+c15kI0GSExui3x0ghkkIB63fHBUuHftIAB3n+dKRBcBTPd 9/nWgBptIplKaDenxkJy2sbyB5BEz6/Kjs8PYIw0+aErs/tvRfcbumcVljbmCoM/WC8q BT06Agjr9TaW6ZAKC+fgi/sLqOlcMZRI/LjayvsS4xXIswOPa6F5tb22pidI/gDtrDFY VezJCVHz4tvsBQWFMxlJzFCPZ87U42jrXqP6aBTfIrIctVAn3YOqJj8Gfp9ocn8ILXdk Q3TXYyxYsgHmKsh7Cx+Pb1aRpvkhf3k6ZpYtiLwucslANZUHAnyU4VkO8YjdUDGsH+Tx mUeg== 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=OkGKAWsqeFr5bgy2DRkaTAoUI+blZCyTqmyjM4teHDg=; b=icjN0AO4SflIVCgTlLHcDKJJIZdVkWIkwFtqlgZJpVxyd2+2pdOUgBJR7/1CVs2eVk m7SIX0tvA4dbmiXlbzp3Gv2DAEap33kNz2z6VkcG+987vAKsXrsKXKMV8RkBhQgIPF0H FFv0nkMyISdcZkytOjBQdIo3KhgReGDRpAU5oxhCP3OdXsy5LGuNntaeusfYPWoZZyYi QKs5EW09xZxKdjeKOKHU1LSoN+TUmSyEcVG9fPRIZuKzs6lk4hpNbqshSv0LjND6G+Xi FXqadxXSRsorrK4XFUFewQCjGkNmGeg+n/KVRYi0nz9/qZ/8InYt3jYg5nBjKd8YjFXd Jq6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-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 i1si4301732jam.63.2021.06.02.01.15.59; Wed, 02 Jun 2021 01:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-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 S230112AbhFBIRl (ORCPT + 4 others); Wed, 2 Jun 2021 04:17:41 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:3343 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbhFBIRk (ORCPT ); Wed, 2 Jun 2021 04:17:40 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fw1v61L6bz19SLV; Wed, 2 Jun 2021 16:11:14 +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; Wed, 2 Jun 2021 16:15:56 +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; Wed, 2 Jun 2021 16:15:55 +0800 From: Zhen Lei To: "Rafael J . Wysocki" , linux-acpi , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] PNP: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 16:15:46 +0800 Message-ID: <20210602081546.11170-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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/pnp/card.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 2430c14f472d26a..d40ed8621571b0a 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -181,8 +181,8 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp return card; } -static ssize_t pnp_show_card_name(struct device *dmdev, - struct device_attribute *attr, char *buf) +static ssize_t name_show(struct device *dmdev, + struct device_attribute *attr, char *buf) { char *str = buf; struct pnp_card *card = to_pnp_card(dmdev); @@ -191,10 +191,10 @@ static ssize_t pnp_show_card_name(struct device *dmdev, return (str - buf); } -static DEVICE_ATTR(name, S_IRUGO, pnp_show_card_name, NULL); +static DEVICE_ATTR_RO(name); -static ssize_t pnp_show_card_ids(struct device *dmdev, - struct device_attribute *attr, char *buf) +static ssize_t card_id_show(struct device *dmdev, + struct device_attribute *attr, char *buf) { char *str = buf; struct pnp_card *card = to_pnp_card(dmdev); @@ -207,7 +207,7 @@ static ssize_t pnp_show_card_ids(struct device *dmdev, return (str - buf); } -static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL); +static DEVICE_ATTR_RO(card_id); static int pnp_interface_attach_card(struct pnp_card *card) {