From patchwork Thu Jun 3 02:21:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453212 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp1093597jao; Wed, 2 Jun 2021 19:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJEnDfkNWUXPKWvevRj+YaAPRM1GrR0Alt80pxAhd+qaNnitJmYj6ka9zJa5pd8Qo8I1+A X-Received: by 2002:a05:6402:50d1:: with SMTP id h17mr43315793edb.199.1622686913092; Wed, 02 Jun 2021 19:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622686913; cv=none; d=google.com; s=arc-20160816; b=BEIJPa43YNaHuoc6Ga3tSb67hkk/xOhSBGLIFtu8Oye53S6Ffv+bPKdHx47l0fFejl iiiifwO84vj2BBln+TrB/yEVpSGYmG4zAGwBmLmfod4weHE441qrS3SS1S38kNWQkafC ro+SM/qBw1+Q0npu10ySc4z3ABXlvjK3mqPQA76/LD81R+La+QfYBOypaz/5GLkv1KWT axeAJe7UrT3Ks8B2HtMJ69qPrav2oShNcLxZTgJi94wztk5ds3mh/xUlS4IEd9io5n1/ ajPnXpSDFEC5PYcwBwbJ0uODIUlxkligKazO6c2PV7moF2YLoRs+L8HMrWPOYy44VY3n dFfw== 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=cpmk7MOnDvCD8j9cKCC/oBqF8YtUoZXp6eVP9tWtVjE=; b=maonsFvqVXHY3EbccODkNRjl7KbiZaSjbe80AdjDsNtgGvJvScWohIXiA/z530mde2 hDuLo21qLZvbz4kzFxQROtqAV3lg+0FtsuOxfdi153ZhxII+XdFL0+E1FRCABrrXfYbp llclihSmmSjny4vhUg4S9xF7yHJKE3X04jWyYkH45Ypvx7L84+DylrSm4dFQpV9aF+z9 7of2VpAifiiNgoKvcU12XJ2ORgukwmraz6LigZsWIP3o4kVRtdcz1MFi6JX0mCk0rwR+ wvE09RCftnxxWcSmBFOTjWtenHRwPLPWM/DoCdS7BDOifBgJuz9lr2ackb8HyF1vOOyE 4xfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 m15si1115205ejb.707.2021.06.02.19.21.52; Wed, 02 Jun 2021 19:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S229695AbhFCCXI (ORCPT + 2 others); Wed, 2 Jun 2021 22:23:08 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3519 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbhFCCXI (ORCPT ); Wed, 2 Jun 2021 22:23:08 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FwV1n4SxnzZcFc for ; Thu, 3 Jun 2021 10:18:37 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) 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 10:21:22 +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 10:21:22 +0800 From: Zhen Lei To: Michael Buesch , linux-wireless CC: Zhen Lei Subject: [PATCH 1/1] ssb: use DEVICE_ATTR_ADMIN_RW macro Date: Thu, 3 Jun 2021 10:21:11 +0800 Message-ID: <20210603022111.11279-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-wireless@vger.kernel.org Use DEVICE_ATTR_ADMIN_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. It normalizes the name of the hook function for read and write operations of the property file, so it's also easier to associate and find. Signed-off-by: Zhen Lei --- drivers/ssb/pci.c | 16 +++++++--------- drivers/ssb/pcmcia.c | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index dac54041ad8d28a..148bcb99c212877 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c @@ -1117,9 +1117,9 @@ const struct ssb_bus_ops ssb_pci_ops = { #endif }; -static ssize_t ssb_pci_attr_sprom_show(struct device *pcidev, - struct device_attribute *attr, - char *buf) +static ssize_t ssb_sprom_show(struct device *pcidev, + struct device_attribute *attr, + char *buf) { struct pci_dev *pdev = container_of(pcidev, struct pci_dev, dev); struct ssb_bus *bus; @@ -1131,9 +1131,9 @@ static ssize_t ssb_pci_attr_sprom_show(struct device *pcidev, return ssb_attr_sprom_show(bus, buf, sprom_do_read); } -static ssize_t ssb_pci_attr_sprom_store(struct device *pcidev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t ssb_sprom_store(struct device *pcidev, + struct device_attribute *attr, + const char *buf, size_t count) { struct pci_dev *pdev = container_of(pcidev, struct pci_dev, dev); struct ssb_bus *bus; @@ -1146,9 +1146,7 @@ static ssize_t ssb_pci_attr_sprom_store(struct device *pcidev, sprom_check_crc, sprom_do_write); } -static DEVICE_ATTR(ssb_sprom, 0600, - ssb_pci_attr_sprom_show, - ssb_pci_attr_sprom_store); +static DEVICE_ATTR_ADMIN_RW(ssb_sprom); void ssb_pci_exit(struct ssb_bus *bus) { diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index d7d730c245c5687..45502098e0c785d 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c @@ -723,9 +723,9 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, return -ENODEV; } -static ssize_t ssb_pcmcia_attr_sprom_show(struct device *pcmciadev, - struct device_attribute *attr, - char *buf) +static ssize_t ssb_sprom_show(struct device *pcmciadev, + struct device_attribute *attr, + char *buf) { struct pcmcia_device *pdev = container_of(pcmciadev, struct pcmcia_device, dev); @@ -739,9 +739,9 @@ static ssize_t ssb_pcmcia_attr_sprom_show(struct device *pcmciadev, ssb_pcmcia_sprom_read_all); } -static ssize_t ssb_pcmcia_attr_sprom_store(struct device *pcmciadev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t ssb_sprom_store(struct device *pcmciadev, + struct device_attribute *attr, + const char *buf, size_t count) { struct pcmcia_device *pdev = container_of(pcmciadev, struct pcmcia_device, dev); @@ -756,9 +756,7 @@ static ssize_t ssb_pcmcia_attr_sprom_store(struct device *pcmciadev, ssb_pcmcia_sprom_write_all); } -static DEVICE_ATTR(ssb_sprom, 0600, - ssb_pcmcia_attr_sprom_show, - ssb_pcmcia_attr_sprom_store); +static DEVICE_ATTR_ADMIN_RW(ssb_sprom); static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor) {