From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: iommu@lists.linux-foundation.org,
linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
Arnd Bergmann <arnd@arndb.de>,
Shaik Ameer Basha <shaik.ameer@samsung.com>,
Cho KyongHo <pullip.cho@samsung.com>,
Joerg Roedel <joro@8bytes.org>,
Thierry Reding <treding@nvidia.com>,
Olof Johansson <olof@lixom.net>, Rob Herring <robh@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Inki Dae <inki.dae@samsung.com>,
Kukjin Kim <kgene.kim@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Tomasz Figa <tomasz.figa@gmail.com>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 04/29] drivers: base: add notifier for failed driver bind
Date: Thu, 21 Aug 2014 21:46:30 +0200 [thread overview]
Message-ID: <5058601.WyRAooKDLt@avalon> (raw)
In-Reply-To: <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com>
Hi Marek,
Thank you for the patch.
On Tuesday 05 August 2014 12:47:32 Marek Szyprowski wrote:
> This patch adds support for getting a notify for failed device driver
> bind, so all the items done in BUS_NOTIFY_BIND_DRIVER event can be
> cleaned if the driver fails to bind.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/base/dd.c | 10 +++++++---
> include/linux/device.h | 4 +++-
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index e4ffbcf..541a41f 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -237,10 +237,14 @@ static int driver_sysfs_add(struct device *dev)
> return ret;
> }
>
> -static void driver_sysfs_remove(struct device *dev)
> +static void driver_sysfs_remove(struct device *dev, int failed)
> {
> struct device_driver *drv = dev->driver;
>
> + if (failed && dev->bus)
> + blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> + BUS_NOTIFY_DRVBIND_FAILED, dev);
This might be a stupid question, but as you only call driver_sysfs_remove with
failed set to true in a single location (in the failure path of really_probe),
how about moving the blocking_notifier_call_chain to that location ? The code
seems to be a bit out of place here.
> +
> if (drv) {
> sysfs_remove_link(&drv->p->kobj, kobject_name(&dev->kobj));
> sysfs_remove_link(&dev->kobj, "driver");
> @@ -316,7 +320,7 @@ static int really_probe(struct device *dev, struct
> device_driver *drv)
>
> probe_failed:
> devres_release_all(dev);
> - driver_sysfs_remove(dev);
> + driver_sysfs_remove(dev, true);
> dev->driver = NULL;
> dev_set_drvdata(dev, NULL);
>
> @@ -509,7 +513,7 @@ static void __device_release_driver(struct device *dev)
> if (drv) {
> pm_runtime_get_sync(dev);
>
> - driver_sysfs_remove(dev);
> + driver_sysfs_remove(dev, false);
>
> if (dev->bus)
> blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> diff --git a/include/linux/device.h b/include/linux/device.h
> index b387710..92daded 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -176,7 +176,7 @@ extern int bus_register_notifier(struct bus_type *bus,
> extern int bus_unregister_notifier(struct bus_type *bus,
> struct notifier_block *nb);
>
> -/* All 4 notifers below get called with the target struct device *
> +/* All 7 notifers below get called with the target struct device *
> * as an argument. Note that those functions are likely to be called
> * with the device lock held in the core, so be careful.
> */
> @@ -189,6 +189,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
> unbound */
> #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
> from the device */
> +#define BUS_NOTIFY_DRVBIND_FAILED 0x00000007 /* driver failed to bind
> + to device */
>
> extern struct kset *bus_get_kset(struct bus_type *bus);
> extern struct klist *bus_get_device_klist(struct bus_type *bus);
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/29] drivers: base: add notifier for failed driver bind
Date: Thu, 21 Aug 2014 21:46:30 +0200 [thread overview]
Message-ID: <5058601.WyRAooKDLt@avalon> (raw)
In-Reply-To: <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com>
Hi Marek,
Thank you for the patch.
On Tuesday 05 August 2014 12:47:32 Marek Szyprowski wrote:
> This patch adds support for getting a notify for failed device driver
> bind, so all the items done in BUS_NOTIFY_BIND_DRIVER event can be
> cleaned if the driver fails to bind.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/base/dd.c | 10 +++++++---
> include/linux/device.h | 4 +++-
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index e4ffbcf..541a41f 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -237,10 +237,14 @@ static int driver_sysfs_add(struct device *dev)
> return ret;
> }
>
> -static void driver_sysfs_remove(struct device *dev)
> +static void driver_sysfs_remove(struct device *dev, int failed)
> {
> struct device_driver *drv = dev->driver;
>
> + if (failed && dev->bus)
> + blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> + BUS_NOTIFY_DRVBIND_FAILED, dev);
This might be a stupid question, but as you only call driver_sysfs_remove with
failed set to true in a single location (in the failure path of really_probe),
how about moving the blocking_notifier_call_chain to that location ? The code
seems to be a bit out of place here.
> +
> if (drv) {
> sysfs_remove_link(&drv->p->kobj, kobject_name(&dev->kobj));
> sysfs_remove_link(&dev->kobj, "driver");
> @@ -316,7 +320,7 @@ static int really_probe(struct device *dev, struct
> device_driver *drv)
>
> probe_failed:
> devres_release_all(dev);
> - driver_sysfs_remove(dev);
> + driver_sysfs_remove(dev, true);
> dev->driver = NULL;
> dev_set_drvdata(dev, NULL);
>
> @@ -509,7 +513,7 @@ static void __device_release_driver(struct device *dev)
> if (drv) {
> pm_runtime_get_sync(dev);
>
> - driver_sysfs_remove(dev);
> + driver_sysfs_remove(dev, false);
>
> if (dev->bus)
> blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> diff --git a/include/linux/device.h b/include/linux/device.h
> index b387710..92daded 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -176,7 +176,7 @@ extern int bus_register_notifier(struct bus_type *bus,
> extern int bus_unregister_notifier(struct bus_type *bus,
> struct notifier_block *nb);
>
> -/* All 4 notifers below get called with the target struct device *
> +/* All 7 notifers below get called with the target struct device *
> * as an argument. Note that those functions are likely to be called
> * with the device lock held in the core, so be careful.
> */
> @@ -189,6 +189,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
> unbound */
> #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
> from the device */
> +#define BUS_NOTIFY_DRVBIND_FAILED 0x00000007 /* driver failed to bind
> + to device */
>
> extern struct kset *bus_get_kset(struct bus_type *bus);
> extern struct klist *bus_get_device_klist(struct bus_type *bus);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-08-21 19:46 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 10:47 [PATCH 00/29] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 01/29] pm: Add PM domain notifications Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 02/29] ARM: Exynos: bind power domains earlier, on device creation Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 03/29] clk: exynos: add missing smmu_g2d clock and update comments Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-18 11:26 ` Tomasz Figa
2014-08-18 11:26 ` Tomasz Figa
2014-08-05 10:47 ` [PATCH 04/29] drivers: base: add notifier for failed driver bind Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-21 19:46 ` Laurent Pinchart [this message]
2014-08-21 19:46 ` Laurent Pinchart
[not found] ` <1407235677-26324-5-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-08-25 20:05 ` Greg Kroah-Hartman
2014-08-25 20:05 ` Greg Kroah-Hartman
2014-08-25 20:05 ` Greg Kroah-Hartman
[not found] ` <20140825200539.GA22076-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-08-26 6:23 ` Marek Szyprowski
2014-08-26 6:23 ` Marek Szyprowski
2014-08-26 6:23 ` Marek Szyprowski
2014-08-25 21:18 ` Joerg Roedel
2014-08-25 21:18 ` Joerg Roedel
2014-08-25 21:18 ` Joerg Roedel
[not found] ` <20140825211823.GH16329-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-08-26 6:30 ` Marek Szyprowski
2014-08-26 6:30 ` Marek Szyprowski
2014-08-26 6:30 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 05/29] drivers: convert suppress_bind_attrs parameter into flags Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 06/29] drivers: iommu: add notify about failed bind Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 07/29] ARM: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 08/29] ARM: dma-mapping: add helpers for managing default per-device dma mappings Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 09/29] ARM: dma-mapping: provide stubs if no ARM_DMA_USE_IOMMU has been selected Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 10/29] drivers: add DRIVER_HAS_OWN_IOMMU_MANAGER flag Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
[not found] ` <1407235677-26324-11-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-09-01 5:22 ` Marek Szyprowski
2014-09-01 5:22 ` Marek Szyprowski
2014-09-01 5:22 ` Marek Szyprowski
2014-09-01 7:07 ` Thierry Reding
2014-09-01 7:07 ` Thierry Reding
2014-09-01 7:07 ` Thierry Reding
[not found] ` <20140901070748.GA24226-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-09-01 7:53 ` Marek Szyprowski
2014-09-01 7:53 ` Marek Szyprowski
2014-09-01 7:53 ` Marek Szyprowski
2014-09-01 9:38 ` Arnd Bergmann
2014-09-01 9:38 ` Arnd Bergmann
2014-09-01 10:47 ` Marek Szyprowski
2014-09-01 10:47 ` Marek Szyprowski
[not found] ` <54044EAC.6010701-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-09-01 11:56 ` Arnd Bergmann
2014-09-01 11:56 ` Arnd Bergmann
2014-09-01 11:56 ` Arnd Bergmann
2014-09-01 12:07 ` Marek Szyprowski
2014-09-01 12:07 ` Marek Szyprowski
[not found] ` <54046186.5030407-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-09-01 13:14 ` [Linaro-mm-sig] " Arnd Bergmann
2014-09-01 13:14 ` Arnd Bergmann
2014-09-01 13:14 ` Arnd Bergmann
2014-08-05 10:47 ` [PATCH 11/29] DRM: exynos: add DRIVER_HAS_OWN_IOMMU_MANAGER flag to all sub-drivers Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 12/29] DRM: Exynos: fix window clear code Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-09-01 13:37 ` Inki Dae
2014-09-01 13:37 ` Inki Dae
2014-08-05 10:47 ` [PATCH 13/29] temporary: media: s5p-mfc: remove DT hacks & initialization custom memory init code Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 14/29] devicetree: Update Exynos SYSMMU device tree bindings Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 15/29] ARM: DTS: Exynos4: add System MMU nodes Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 16/29] iommu: exynos: make driver multiarch friendly Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 17/29] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 18/29] iommu: exynos: remove unused functions Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 19/29] iommu: exynos: remove useless spinlock Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 20/29] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 21/29] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 22/29] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 23/29] iommu: exynos: init iommu controllers from device tree Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 24/29] iommu: exynos: create default iommu-based dma-mapping for master devices Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 25/29] iommu: exynos: add support for runtime_pm Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 26/29] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 27/29] iommu: exynos: document internal structures Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 28/29] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 29/29] temporary: media: s5p-mfc: add support for IOMMU Marek Szyprowski
2014-08-05 10:47 ` Marek Szyprowski
[not found] ` <1407235677-26324-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-08-18 23:32 ` [PATCH 00/29] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Joerg Roedel
2014-08-18 23:32 ` Joerg Roedel
2014-08-18 23:32 ` Joerg Roedel
[not found] ` <20140818233201.GL9809-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-08-19 6:07 ` Marek Szyprowski
2014-08-19 6:07 ` Marek Szyprowski
2014-08-19 6:07 ` Marek Szyprowski
2014-08-19 11:39 ` Andreas Färber
2014-08-19 11:39 ` Andreas Färber
[not found] ` <53F3375E.6030402-l3A5Bk7waGM@public.gmane.org>
2014-08-19 12:01 ` Marek Szyprowski
2014-08-19 12:01 ` Marek Szyprowski
2014-08-19 12:01 ` Marek Szyprowski
2014-08-19 12:30 ` Andreas Färber
2014-08-19 12:30 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5058601.WyRAooKDLt@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=inki.dae@samsung.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=olof@lixom.net \
--cc=pullip.cho@samsung.com \
--cc=rjw@rjwysocki.net \
--cc=robh@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=shaik.ameer@samsung.com \
--cc=tomasz.figa@gmail.com \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.