From patchwork Thu Jun 3 08:22:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 453227 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp74058jao; Thu, 3 Jun 2021 01:23:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaQZ+7dQHs8tirvvcx4vDNdKFldFx4UmmcmgcpWAu217NkufL09/gULFUriLaF/A1/SZBO X-Received: by 2002:aa7:d648:: with SMTP id v8mr12329125edr.203.1622708609535; Thu, 03 Jun 2021 01:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622708609; cv=none; d=google.com; s=arc-20160816; b=gi7whx+fXiZqmvGhtXRGXQMvMgmhGaBEP5SSv3Q4vUo2B8hK/PYbdXXbzWO7SyY50V 3Tep0cxh7TExLhwPUq6RpG4M1mIgrCJDSKC7Oz9TsqHe55BhGBuF4bvpUyGTDZHxO1bR yJRuihxG5T72vxlekFf9kyCA4NZsWl+loHwxJmxBwFs5OpihJp3O2XmC45pIhzNyZInQ 0QfA/68Um5EtYlMyuH0i8Ez9Tw/jfueAB/MRVB9YQnHjq5Qe87q8BZKnYV+SntGImaEp A+ZtP/2We0uj2JW5gRIer4YTpFWx3npj+fhuB+apX5WSR02p9DLWy4CH+jdQDujNbDXG fxMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9D052MeDRtpbnTxJeNbyKdirZr7qp9ifAvZrOk4x550=; b=rNxxZnxrN4ZZckNRWE8RyK5zBnxcs9FwFjZHozalqHYiXEYvbL1YowWuvigrTe23Lw Tmp5CdAzxaOXOpaX+7blcPoMUBOiIsvi8XVU1qM+of5ISpp+SXGWhQ+NC6Vq2J1Gq8wx byyEapJ14XxAvl0D7g8u21ObGXqC9VGaXV+wphPnLL+UObhC1H1l3M11I7VAJi8o391L oj620P9EJ/4WfGe3DddISVG/Ri0Ih0H2bO3hy384GBRrtNmqk58kycoqwA7t3Vbjc1jj 6UmCU+WxTqMyQ/t3a5LqZU8AUAjCnnmqm+53HFD7AD9q8tkvwwd5w1PY+0lyu+hla4xI Y/3A== 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 k16si1903143edo.475.2021.06.03.01.23.29; Thu, 03 Jun 2021 01:23:29 -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 S229685AbhFCIYb (ORCPT + 2 others); Thu, 3 Jun 2021 04:24:31 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3528 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbhFCIYa (ORCPT ); Thu, 3 Jun 2021 04:24:30 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fwf2k373JzZcG2 for ; Thu, 3 Jun 2021 16:19:58 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) 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 16:22:42 +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 16:22:42 +0800 From: Zhen Lei To: Michael Buesch , linux-wireless CC: Zhen Lei Subject: [PATCH v2 1/1] ssb: use DEVICE_ATTR_ADMIN_RW() helper macro Date: Thu, 3 Jun 2021 16:22:18 +0800 Message-ID: <20210603082218.11718-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210603082218.11718-1-thunder.leizhen@huawei.com> References: <20210603082218.11718-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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() helper macro instead of DEVICE_ATTR(), making it simpler and easier to read. Because the read and write function names of the sysfs attribute have been normalized, there is a natural association. 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) {