From patchwork Wed Jul 19 14:43:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 9852313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3736602C8 for ; Wed, 19 Jul 2017 14:46:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2B6D25F3E for ; Wed, 19 Jul 2017 14:46:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95F0E2862A; Wed, 19 Jul 2017 14:46:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2353C25F3E for ; Wed, 19 Jul 2017 14:46:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXqCg-0006PQ-Nh; Wed, 19 Jul 2017 14:43:54 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXqCf-0006PH-6X for xen-devel@lists.xenproject.org; Wed, 19 Jul 2017 14:43:53 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 38/36-02962-8207F695; Wed, 19 Jul 2017 14:43:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXSc3klj65GQX6 kwbpnzBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a0rjOsBV8VKm4fW8LYwPhMuouRi0NIYAej xOL2Q6xdjJwcLAKqEo2TG5lBbDYBLYme2WtYuhg5OEQEgiS+bmYCCTMLOEhc7v0GZgsD2ZPPN bGD2LwCehJzPyxgA7GFgOzDV5cwQcQFJU7OfMIC0aslcePfSyaQkcwC0hLL/3GAhDkF9CW27n kG1ioqoCwxb98qtgmMvLOQdM9C0j0LoXsBI/MqRo3i1KKy1CJdI2O9pKLM9IyS3MTMHF1DAzO 93NTi4sT01JzEpGK95PzcTYzAgGIAgh2Mf+YHHmKU5GBSEuWdw5sfKcSXlJ9SmZFYnBFfVJqT WnyIUYaDQ0mC92IeUE6wKDU9tSItMwcY2jBpCQ4eJRHeTyBp3uKCxNzizHSI1ClGXY4Nq9d/Y RJiycvPS5US520FKRIAKcoozYMbAYuzS4yyUsK8jEBHCfEUpBblZpagyr9iFOdgVBLmvQYyhS czrwRu0yugI5iAjhD2zQE5oiQRISXVwNj1TG7rsaRGzchPG66LPBT69svkltWdppsrefb/6Vh 8UtJ//+ZX0jpWmfvVl15L6737RCVROPdD3xT3KdNfp95Z8WjFPtfHK2o9LANFVlW3b/tqZxso tO2/Y3fGI78z9fdbbdb789hdO2Ahanqr7N47F/faV/9MZmWbvMkQemHFqlH3mfXnU1slluKMR EMt5qLiRADnTAFUrgIAAA== X-Env-Sender: gregkh@linuxfoundation.org X-Msg-Ref: server-8.tower-27.messagelabs.com!1500475430!97639429!1 X-Originating-IP: [140.211.169.12] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30824 invoked from network); 19 Jul 2017 14:43:51 -0000 Received: from mail.linuxfoundation.org (HELO mail.linuxfoundation.org) (140.211.169.12) by server-8.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Jul 2017 14:43:51 -0000 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AD542957; Wed, 19 Jul 2017 14:43:49 +0000 (UTC) Date: Wed, 19 Jul 2017 16:43:44 +0200 From: Greg KH To: Boris Ostrovsky , Juergen Gross Message-ID: <20170719144344.GA10632@kroah.com> References: <20170719125817.GD17776@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170719125817.GD17776@kroah.com> User-Agent: Mutt/1.8.3 (2017-05-23) Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH v2] xen: xen-pciback: remove DRIVER_ATTR() usage X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Greg Kroah-Hartman It's better to be explicit and use the DRIVER_ATTR_RW() and DRIVER_ATTR_RO() macros when defining a driver's sysfs file. Bonus is this fixes up a checkpatch.pl warning. This is part of a series to drop DRIVER_ATTR() from the tree entirely. Cc: Boris Ostrovsky Cc: Juergen Gross Signed-off-by: Greg Kroah-Hartman Reviewed-by: Juergen Gross --- v2: fix build error (quirks_store was wrong), thanks to Juergen for the catch, it's now correctly build tested locally... drivers/xen/xen-pciback/pci_stub.c | 44 ++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 24 deletions(-) --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -1172,8 +1172,8 @@ out: return err; } -static ssize_t pcistub_slot_add(struct device_driver *drv, const char *buf, - size_t count) +static ssize_t new_slot_store(struct device_driver *drv, const char *buf, + size_t count) { int domain, bus, slot, func; int err; @@ -1189,10 +1189,10 @@ out: err = count; return err; } -static DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add); +static DRIVER_ATTR_WO(new_slot); -static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf, - size_t count) +static ssize_t remove_slot_store(struct device_driver *drv, const char *buf, + size_t count) { int domain, bus, slot, func; int err; @@ -1208,9 +1208,9 @@ out: err = count; return err; } -static DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove); +static DRIVER_ATTR_WO(remove_slot); -static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf) +static ssize_t slots_show(struct device_driver *drv, char *buf) { struct pcistub_device_id *pci_dev_id; size_t count = 0; @@ -1231,9 +1231,9 @@ static ssize_t pcistub_slot_show(struct return count; } -static DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL); +static DRIVER_ATTR_RO(slots); -static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf) +static ssize_t irq_handlers_show(struct device_driver *drv, char *buf) { struct pcistub_device *psdev; struct xen_pcibk_dev_data *dev_data; @@ -1260,11 +1260,10 @@ static ssize_t pcistub_irq_handler_show( spin_unlock_irqrestore(&pcistub_devices_lock, flags); return count; } -static DRIVER_ATTR(irq_handlers, S_IRUSR, pcistub_irq_handler_show, NULL); +static DRIVER_ATTR_RO(irq_handlers); -static ssize_t pcistub_irq_handler_switch(struct device_driver *drv, - const char *buf, - size_t count) +static ssize_t irq_handler_state_store(struct device_driver *drv, + const char *buf, size_t count) { struct pcistub_device *psdev; struct xen_pcibk_dev_data *dev_data; @@ -1301,11 +1300,10 @@ out: err = count; return err; } -static DRIVER_ATTR(irq_handler_state, S_IWUSR, NULL, - pcistub_irq_handler_switch); +static DRIVER_ATTR_WO(irq_handler_state); -static ssize_t pcistub_quirk_add(struct device_driver *drv, const char *buf, - size_t count) +static ssize_t quirks_store(struct device_driver *drv, const char *buf, + size_t count) { int domain, bus, slot, func, reg, size, mask; int err; @@ -1323,7 +1321,7 @@ out: return err; } -static ssize_t pcistub_quirk_show(struct device_driver *drv, char *buf) +static ssize_t quirks_show(struct device_driver *drv, char *buf) { int count = 0; unsigned long flags; @@ -1366,11 +1364,10 @@ out: return count; } -static DRIVER_ATTR(quirks, S_IRUSR | S_IWUSR, pcistub_quirk_show, - pcistub_quirk_add); +static DRIVER_ATTR_RW(quirks); -static ssize_t permissive_add(struct device_driver *drv, const char *buf, - size_t count) +static ssize_t permissive_store(struct device_driver *drv, const char *buf, + size_t count) { int domain, bus, slot, func; int err; @@ -1431,8 +1428,7 @@ static ssize_t permissive_show(struct de spin_unlock_irqrestore(&pcistub_devices_lock, flags); return count; } -static DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, - permissive_add); +static DRIVER_ATTR_RW(permissive); static void pcistub_exit(void) {