RE: [PATCH] of: introduces helper to manage optional property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> > @@ -601,6 +601,23 @@ static inline int of_property_read_u32(const struct
> device_node *np,
> >  	return of_property_read_u32_array(np, propname, out_value, 1);
> >  }
> >
> > +/**
> > + * of_property_optional - Find one optional property
> > + * @np:		device node from which the property to be searched.
> > + * @propname:	name of the optional property to be searched for.
> > + *
> > + * Get to know whether one optional property is present or not in a
> > + * device node.
> > + * Returns true if the property is present, false otherwise.
> > + */
> > +static inline bool of_property_optional(const struct device_node *np,
> > +					 const char *propname)
> > +{
> > +	struct property *prop = of_find_property(np, propname, NULL);
> > +
> > +	return prop ? true : false;
> > +}
> > +
> 
> Exactly how is this different from of_property_read_bool()?
> AFAICS it's identical!  You may be trying to solve the wrong
> problem.
> 
> And I'm afraid that the routine's name you picked is even more
> confusing.  The call site ("if (of_property_optional() ...") will
> no longer reflect that it's evaluating a boolean condition.
> Being an optional property and being boolean are two completely
> different things.
> 
> 

Yes, That's right.

Thanks,
Best Regards,



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux