From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756691AbcBJBZS (ORCPT ); Tue, 9 Feb 2016 20:25:18 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60345 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756523AbcBJBZQ (ORCPT ); Tue, 9 Feb 2016 20:25:16 -0500 Date: Tue, 9 Feb 2016 17:25:15 -0800 From: Greg Kroah-Hartman To: Geliang Tang Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] driver core: bus: add a new helper to_driver_private_bus Message-ID: <20160210012515.GA15042@kroah.com> References: <446b40b7b494a2b06bbab6bfae7c2973affb0fcf.1452006001.git.geliangtang@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2016 at 11:03:39PM +0800, Geliang Tang wrote: > Add a new helper to_driver_private_bus() for consistency with > to_device_private_bus() and use it in bus.c. > > Signed-off-by: Geliang Tang > --- > drivers/base/base.h | 2 ++ > drivers/base/bus.c | 2 +- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/base.h b/drivers/base/base.h > index e05db38..88119d6 100644 > --- a/drivers/base/base.h > +++ b/drivers/base/base.h > @@ -51,6 +51,8 @@ struct driver_private { > struct device_driver *driver; > }; > #define to_driver(obj) container_of(obj, struct driver_private, kobj) > +#define to_driver_private_bus(obj) \ > + container_of(obj, struct driver_private, knode_bus) > > /** > * struct device_private - structure to hold the private to the driver core portions of the device structure. > diff --git a/drivers/base/bus.c b/drivers/base/bus.c > index 6470eb8..ddc2b0b 100644 > --- a/drivers/base/bus.c > +++ b/drivers/base/bus.c > @@ -422,7 +422,7 @@ static struct device_driver *next_driver(struct klist_iter *i) > struct driver_private *drv_priv; > > if (n) { > - drv_priv = container_of(n, struct driver_private, knode_bus); > + drv_priv = to_driver_private_bus(n); No need for a macro in a .h file that is only used in one place in one file, right?