lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 6 Oct 2015 13:39:50 +0000
From:	Katz Itai <itai.katz@...escale.com>
To:	Mike Rapoport <mike.rapoport@...il.com>
CC:	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"arnd@...db.de" <arnd@...db.de>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Stuart Yoder <stuart.yoder@...escale.com>,
	Sharma Bhupesh <bhupesh.sharma@...escale.com>,
	Jose Rivera <German.Rivera@...escale.com>,
	"agraf@...e.de" <agraf@...e.de>,
	Hamciuc Bogdan <bhamciu1@...escale.com>,
	Erez Nir <nir.erez@...escale.com>,
	Scott Wood <scottwood@...escale.com>,
	Lijun Pan <Lijun.Pan@...escale.com>,
	Marginean Alexandru <R89243@...escale.com>,
	"dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
	Richard Schmitt <richard.schmitt@...escale.com>
Subject: RE: [PATCH 2/5] staging: fsl-mc: abstract test for whether a dprc is
 a root dprc


> -----Original Message-----
> From: Mike Rapoport [mailto:mike.rapoport@...il.com]
> Sent: Tuesday, October 06, 2015 11:48 AM
> To: katz Itai-RM05202 <itai.katz@...escale.com>
> Cc: gregkh@...uxfoundation.org; arnd@...db.de;
> devel@...verdev.osuosl.org; linux-kernel@...r.kernel.org; Yoder Stuart-
> B08248 <stuart.yoder@...escale.com>; Sharma Bhupesh-B45370
> <bhupesh.sharma@...escale.com>; Rivera Jose-B46482
> <German.Rivera@...escale.com>; agraf@...e.de; Hamciuc Bogdan-
> BHAMCIU1 <bhamciu1@...escale.com>; Erez Nir-RM30794
> <nir.erez@...escale.com>; Wood Scott-B07421
> <scottwood@...escale.com>; Pan Lijun-B44306 <Lijun.Pan@...escale.com>;
> Marginean Alexandru-R89243 <R89243@...escale.com>;
> dan.carpenter@...cle.com; Schmitt Richard-B43082
> <richard.schmitt@...escale.com>
> Subject: Re: [PATCH 2/5] staging: fsl-mc: abstract test for whether a dprc is a
> root dprc
> 
> On Sun, Oct 04, 2015 at 10:09:51AM +0300, itai.katz@...escale.com wrote:
> > From: Itai Katz <itai.katz@...escale.com>
> >
> > Instead of relying on assumptions about fields in data
> > structures, abstract the test for whether a dprc is a root
> > dprc into a function.
> >
> > Signed-off-by: Itai Katz <itai.katz@...escale.com>
> > ---
> >  drivers/staging/fsl-mc/bus/mc-bus.c |   16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-
> mc/bus/mc-bus.c
> > index 2aaeb3a..6a6c5a6 100644
> > --- a/drivers/staging/fsl-mc/bus/mc-bus.c
> > +++ b/drivers/staging/fsl-mc/bus/mc-bus.c
> > @@ -22,6 +22,8 @@
> >
> >  static struct kmem_cache *mc_dev_cache;
> >
> > +static bool fsl_mc_is_root_dprc(struct device *dev);
> 
> Prefer defining functions before they are used rather than using forward
> declarations.

Thanks for the comment.
Since this patch was already added in Greg's staging git tree, I'll consider fixing this in a separate cleanup patch.

> 
> > +
> >  /**
> >   * fsl_mc_bus_match - device to driver matching callback
> >   * @dev: the MC object device structure to match against
> > @@ -50,7 +52,7 @@ static int fsl_mc_bus_match(struct device *dev, struct
> device_driver *drv)
> >  	 * Only exception is the root DPRC, which is a special case.
> >  	 */
> >  	if ((mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED) == 0
> &&
> > -	    &mc_dev->dev != fsl_mc_bus_type.dev_root)
> > +	    !fsl_mc_is_root_dprc(&mc_dev->dev))
> >  		goto out;
> >
> >  	/*
> > @@ -215,6 +217,14 @@ bool fsl_mc_bus_exists(void)
> >  }
> >  EXPORT_SYMBOL_GPL(fsl_mc_bus_exists);
> >
> > +/**
> > + * fsl_mc_is_root_dprc - function to check if a given device is a root dprc
> > + */
> > +static bool fsl_mc_is_root_dprc(struct device *dev)
> > +{
> > +	return dev == fsl_mc_bus_type.dev_root;
> > +}
> > +
> >  static int get_dprc_icid(struct fsl_mc_io *mc_io,
> >  			 int container_id, u16 *icid)
> >  {
> > @@ -500,7 +510,7 @@ void fsl_mc_device_remove(struct fsl_mc_device
> *mc_dev)
> >  			mc_dev->mc_io = NULL;
> >  		}
> >
> > -		if (&mc_dev->dev == fsl_mc_bus_type.dev_root)
> > +		if (fsl_mc_is_root_dprc(&mc_dev->dev))
> >  			fsl_mc_bus_type.dev_root = NULL;
> >  	}
> >
> > @@ -726,7 +736,7 @@ static int fsl_mc_bus_remove(struct
> platform_device *pdev)
> >  {
> >  	struct fsl_mc *mc = platform_get_drvdata(pdev);
> >
> > -	if (WARN_ON(&mc->root_mc_bus_dev->dev !=
> fsl_mc_bus_type.dev_root))
> > +	if (WARN_ON(!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev-
> >dev)))
> >  		return -EINVAL;
> >
> >  	fsl_mc_device_remove(mc->root_mc_bus_dev);
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > devel mailing list
> > devel@...uxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists