Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573138

Re: [PATCH v5 1/4] device property: allow to constify properties

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/4] device property: allow to constify properties
Date 2017-02-03 16:10 +0100
Message-ID <t6NER-38j-3@gated-at.bofh.it> (permalink)
References <t6BaF-3o4-5@gated-at.bofh.it> <t6BaG-3o4-11@gated-at.bofh.it> <t6Kxk-149-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Feb 03, 2017 at 01:40:21PM +0200, Andy Shevchenko wrote:
> On Thu, 2017-02-02 at 17:41 -0800, Dmitry Torokhov wrote:
> > There is no reason why statically defined properties should be
> > modifiable,
> > so let's make device_add_properties() and the rest of pset_*()
> > functions to
> > take const pointers to properties.
> > 
> > This will allow us to mark properties as const/__initconst at
> > definition
> > sites.
> > 
> 
> Looks good to me.
> 
> FWIW:
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Though, nitpicks below.
>  
> >  static struct property_set *pset_copy_set(const struct property_set
> > *pset)
> >  {
> > -	const struct property_entry *entry;
> > +	struct property_entry *props;
> 
> Can we leave the name?
>  
> > -	p->properties = kcalloc(n + 1, sizeof(*entry), GFP_KERNEL);
> > 
> > +	p->properties = props = kcalloc(n + 1, sizeof(*props),
> > GFP_KERNEL);
> >  	if (!p->properties) {
> >  		kfree(p);
> >  		return ERR_PTR(-ENOMEM);
> >  	}
> >  
> >  	for (i = 0; i < n; i++) {
> 
> > -		int ret = pset_copy_entry(&p->properties[i],
> > +		int ret = pset_copy_entry(&props[i],
> >  					  &pset->properties[i]);
> 
> Do we need these changes?

Didn't want to wrap the line, the name is restored later anyway.

Thanks.

-- 
Dmitry

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v5 1/4] device property: allow to constify properties Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 02:50 +0100
  Re: [PATCH v5 1/4] device property: allow to constify properties Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-02-03 12:50 +0100
    Re: [PATCH v5 1/4] device property: allow to constify properties Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 16:10 +0100

csiph-web