From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH 04/29] drivers: base: add notifier for failed driver bind Date: Mon, 25 Aug 2014 13:05:39 -0700 Message-ID: <20140825200539.GA22076@kroah.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1407235677-26324-5-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Marek Szyprowski Cc: Thierry Reding , linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Shaik Ameer Basha , Arnd Bergmann , Rob Herring , Inki Dae , "Rafael J. Wysocki" , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tomasz Figa , linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Kukjin Kim , Laurent Pinchart , Sylwester Nawrocki , Kyungmin Park , Cho KyongHo , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Tue, Aug 05, 2014 at 12:47:32PM +0200, 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. But doesn't the bus know if the driver fails to bind, so why would a notifier be needed here? Can't it unwind any problems then? > Signed-off-by: Marek Szyprowski > --- > 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) I _hate_ having functions with a flag that does something different depending on it. If you _really_ need this, just make the notifier call before calling this function, which should work just fine, right? thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregkh@linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 25 Aug 2014 13:05:39 -0700 Subject: [PATCH 04/29] drivers: base: add notifier for failed driver bind In-Reply-To: <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com> Message-ID: <20140825200539.GA22076@kroah.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Aug 05, 2014 at 12:47:32PM +0200, 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. But doesn't the bus know if the driver fails to bind, so why would a notifier be needed here? Can't it unwind any problems then? > Signed-off-by: Marek Szyprowski > --- > 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) I _hate_ having functions with a flag that does something different depending on it. If you _really_ need this, just make the notifier call before calling this function, which should work just fine, right? thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756543AbaHYUGW (ORCPT ); Mon, 25 Aug 2014 16:06:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32965 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754647AbaHYUGU (ORCPT ); Mon, 25 Aug 2014 16:06:20 -0400 Date: Mon, 25 Aug 2014 13:05:39 -0700 From: Greg Kroah-Hartman To: Marek Szyprowski 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 , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , "Rafael J. Wysocki" , Inki Dae , Kukjin Kim , Sylwester Nawrocki , Tomasz Figa , Kyungmin Park Subject: Re: [PATCH 04/29] drivers: base: add notifier for failed driver bind Message-ID: <20140825200539.GA22076@kroah.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1407235677-26324-5-git-send-email-m.szyprowski@samsung.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 05, 2014 at 12:47:32PM +0200, 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. But doesn't the bus know if the driver fails to bind, so why would a notifier be needed here? Can't it unwind any problems then? > Signed-off-by: Marek Szyprowski > --- > 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) I _hate_ having functions with a flag that does something different depending on it. If you _really_ need this, just make the notifier call before calling this function, which should work just fine, right? thanks, greg k-h