From patchwork Tue Aug 5 10:47:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34909 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B665B20523 for ; Tue, 5 Aug 2014 10:49:06 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf4662683pdb.9 for ; Tue, 05 Aug 2014 03:49:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=xAo/x8iaux2z1kBbGA0ram3RuONzWCVccrMb3H4nm0o=; b=TMF1ZXQjelt+K33/4WDpPY+rdXOcyCyj4hGfit7D8sqL5B1rGv4gZVawkoACr+AUYg LUHtgcIE25eGVRGMk+9kvp3j2teLLDLx0ByJUmnXYazi3ZHLBNXkq6Kv86zizM3Cpyje swtCz7FNWWztjcdlISoxenSIPqAqZ63l06/GjIn31ZagU9+cm4W1HS2/A1z2RG/Ri1dS SxPDF12qRjDnpHTnOQ+xsG/WuuqlOBMzcOkCP8WIJYTHF84uTTOlBs31BpUBXSG9fekW N4KB5r1Txhct/hohmxBLP7met1YlPJ7U/sYjzmhaSAXJrAUMlXhbGMqYkgvyzU8732Sp s4nQ== X-Gm-Message-State: ALoCoQlXtyplsBmg4TWyOM2StSAqYCVsw8gqkHIoroHKMQXNtmgBDsG+IOsVv0UVqS3KvNo6EaMb X-Received: by 10.66.187.8 with SMTP id fo8mr1601184pac.32.1407235745979; Tue, 05 Aug 2014 03:49:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.80 with SMTP id t74ls219535qge.32.gmail; Tue, 05 Aug 2014 03:49:05 -0700 (PDT) X-Received: by 10.52.179.161 with SMTP id dh1mr325044vdc.78.1407235745848; Tue, 05 Aug 2014 03:49:05 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id u7si781440vdc.40.2014.08.05.03.49.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:49:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so1109030vcb.12 for ; Tue, 05 Aug 2014 03:49:05 -0700 (PDT) X-Received: by 10.220.131.207 with SMTP id y15mr48153vcs.71.1407235745758; Tue, 05 Aug 2014 03:49:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374535vcb; Tue, 5 Aug 2014 03:49:05 -0700 (PDT) X-Received: by 10.70.63.37 with SMTP id d5mr3183849pds.51.1407235744790; Tue, 05 Aug 2014 03:49:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id es5si1560954pbb.15.2014.08.05.03.49.04 for ; Tue, 05 Aug 2014 03:49:04 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969AbaHEKs6 (ORCPT + 6 others); Tue, 5 Aug 2014 06:48:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:9316 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754756AbaHEKs4 (ORCPT ); Tue, 5 Aug 2014 06:48:56 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T001JBY0YNO90@mailout2.w1.samsung.com>; Tue, 05 Aug 2014 11:48:35 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-7e-53e0b695ad55 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id DF.CC.15956.596B0E35; Tue, 05 Aug 2014 11:48:53 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:48:53 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Greg Kroah-Hartman , "Rafael J. Wysocki" , Inki Dae , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Kyungmin Park Subject: [PATCH 05/29] drivers: convert suppress_bind_attrs parameter into flags Date: Tue, 05 Aug 2014 12:47:33 +0200 Message-id: <1407235677-26324-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t/xq7pTtz0INriwQcDi76Rj7BbNi9ez WUy6P4HFYsF+a4vO2RvYLXoXXGWzONv0ht2ic+ISdosvVx4yWWx6fI3V4vKuOWwWM87vY7JY e+Quu8Wp65/ZLP71HmS0OHP6EqvF/z072C0Ov2lntTjycDe7xapdfxgtbv/mcxD1eHJwHpPH 71+TGD12zrrL7jG7Yyarx6ZVnWwe++euYffYvKTe4/a/x8wek28sZ/S4cqKJ1aO3+R2bx5ar 7SwefVtWMXp83iQXwBfFZZOSmpNZllqkb5fAlbFgwzq2gjv6Ff1N19kaGI+qdzFyckgImEjc O3+WGcIWk7hwbz1bFyMXh5DAUkaJ9Ve+skA4fUwSU68fAatiEzCU6HrbBVYlItDLKNHf9IMJ xGEWWMcqsb/3OgtIlbBAgMTKGZOYQGwWAVWJ9pNtYN28Ah4S5+dMZoTYJyfx/+UKsBpOAU+J wzcPsILYQkA1PzesYZ/AyLuAkWEVo2hqaXJBcVJ6rpFecWJucWleul5yfu4mRkjsfN3BuPSY 1SFGAQ5GJR5ehb13g4VYE8uKK3MPMUpwMCuJ8EqseRAsxJuSWFmVWpQfX1Sak1p8iJGJg1Oq gbHvRb5gt7yBBcfepnRPJm9BtuyGaXp7uKtU92mVT67zZjb2ubuB22z3o0XBtd+DxVtdo/59 /lzQvtPoNRML+42NCitFk1a/NzN11fiY+zvZzmfvUfWDgfNswqY/O/j5TenDRV3yJxdfrO06 vuXPSZ+HgUvTTXtu9B2XDtvNt1qtxOXvl70SakosxRmJhlrMRcWJAAhL9Q97AgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch extends struct device_driver with a flags member and converts existing suppress_bind_attrs bool field to a flag. This way new flags can be easily added in the future without changing the structure itself. Signed-off-by: Marek Szyprowski --- arch/arm/mach-integrator/impd1.c | 2 +- drivers/base/bus.c | 4 ++-- drivers/base/platform.c | 2 +- drivers/pci/host/pci-mvebu.c | 2 +- drivers/pci/host/pci-rcar-gen2.c | 2 +- drivers/pci/host/pci-tegra.c | 2 +- drivers/pci/host/pcie-rcar.c | 2 +- drivers/soc/tegra/pmc.c | 2 +- include/linux/device.h | 6 ++++-- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 3ce8807..a7e7330 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -406,7 +406,7 @@ static struct lm_driver impd1_driver = { * As we're dropping the probe() function, suppress driver * binding from sysfs. */ - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, }, .probe = impd1_probe, .remove = impd1_remove, diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a..f223f26 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -707,7 +707,7 @@ int bus_add_driver(struct device_driver *drv) __func__, drv->name); } - if (!drv->suppress_bind_attrs) { + if (!(drv->flags & DRIVER_SUPPRESS_BIND_ATTRS)) { error = add_bind_files(drv); if (error) { /* Ditto */ @@ -740,7 +740,7 @@ void bus_remove_driver(struct device_driver *drv) if (!drv->bus) return; - if (!drv->suppress_bind_attrs) + if (!(drv->flags & DRIVER_SUPPRESS_BIND_ATTRS)) remove_bind_files(drv); driver_remove_groups(drv, drv->bus->drv_groups); driver_remove_file(drv, &driver_attr_uevent); diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 68a8b77..c696058 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -608,7 +608,7 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, drv->prevent_deferred_probe = true; /* make sure driver won't have bind/unbind attributes */ - drv->driver.suppress_bind_attrs = true; + drv->driver.flags = DRIVER_SUPPRESS_BIND_ATTRS; /* temporary section violation during probe() */ drv->probe = probe; diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index a8c6f1a..6815c50 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -1086,7 +1086,7 @@ static struct platform_driver mvebu_pcie_driver = { .name = "mvebu-pcie", .of_match_table = mvebu_pcie_of_match_table, /* driver unloading/unbinding currently not supported */ - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, }, .probe = mvebu_pcie_probe, }; diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index 3ef854f..6f1b890 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -413,7 +413,7 @@ static struct platform_driver rcar_pci_driver = { .driver = { .name = "pci-rcar-gen2", .owner = THIS_MODULE, - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, .of_match_table = rcar_pci_of_match, }, .probe = rcar_pci_probe, diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 0fb0fdb..2e1698d 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -1927,7 +1927,7 @@ static struct platform_driver tegra_pcie_driver = { .name = "tegra-pcie", .owner = THIS_MODULE, .of_match_table = tegra_pcie_of_match, - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, }, .probe = tegra_pcie_probe, }; diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 4884ee5..9a1936e 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -981,7 +981,7 @@ static struct platform_driver rcar_pcie_driver = { .name = DRV_NAME, .owner = THIS_MODULE, .of_match_table = rcar_pcie_of_match, - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, }, .probe = rcar_pcie_probe, }; diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index a2c0ceb..77c3eb3 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -892,7 +892,7 @@ static const struct of_device_id tegra_pmc_match[] = { static struct platform_driver tegra_pmc_driver = { .driver = { .name = "tegra-pmc", - .suppress_bind_attrs = true, + .flags = DRIVER_SUPPRESS_BIND_ATTRS, .of_match_table = tegra_pmc_match, .pm = &tegra_pmc_pm_ops, }, diff --git a/include/linux/device.h b/include/linux/device.h index 92daded..5f4ff02 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -201,7 +201,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus); * @bus: The bus which the device of this driver belongs to. * @owner: The module owner. * @mod_name: Used for built-in modules. - * @suppress_bind_attrs: Disables bind/unbind via sysfs. + * @flags: Flags defining driver behaviour, see below. * @of_match_table: The open firmware table. * @acpi_match_table: The ACPI match table. * @probe: Called to query the existence of a specific device, @@ -234,7 +234,7 @@ struct device_driver { struct module *owner; const char *mod_name; /* used for built-in modules */ - bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ + unsigned long flags; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; @@ -251,6 +251,8 @@ struct device_driver { struct driver_private *p; }; +/* disables bind/unbind via sysfs */ +#define DRIVER_SUPPRESS_BIND_ATTRS (1 << 0) extern int __must_check driver_register(struct device_driver *drv); extern void driver_unregister(struct device_driver *drv);