Re: [PATCH v3 3/3] lib/vsprintf: add two device node flags

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

 



On Mon 2020-01-20 16:19:51, Andy Shevchenko wrote:
> On Mon, Jan 20, 2020 at 07:38:29PM +0800, lijiazi wrote:
> > Add two device node flags, and use OF_DEVICE_NODE_FLAG_MAX instead
> > of sizeof("xxxx").
> 
> ...
> 
> >  			tbuf[1] = of_node_check_flag(dn, OF_DETACHED) ? 'd' : '-';
> >  			tbuf[2] = of_node_check_flag(dn, OF_POPULATED) ? 'P' : '-';
> >  			tbuf[3] = of_node_check_flag(dn, OF_POPULATED_BUS) ? 'B' : '-';
> 
> > -			tbuf[4] = 0;
> 
> This is fine to leave untouched. See below.
> 
> > +			tbuf[4] = of_node_check_flag(dn, OF_OVERLAY) ? 'O' : '-';
> > +			tbuf[5] = of_node_check_flag(dn, OF_OVERLAY_FREE_CSET) ? 'F' : '-';
> 
> These two should be part of patch 1, which in turn should be last in the series.
> 
> > +			tbuf[OF_DEVICE_NODE_FLAG_MAX] = 0;
> 
> This one also, but in a form of explicit number, if you afraid of problems
> here, we may add something like

I agree that explicit number would be better here:

			tbuf[6] = 0;

And I like the build check. I would even check for the exact number.
It would help to keep the code updated when the number is modified.

	BUILD_BUG_ON(OF_DEVICE_NODE_FLAG_MAX != 6);

Finally, I would put all three changes into the same patch. And
remove the comment above OF_DEVICE_NODE_FLAG_MAX definition
completely.

Best Regards,
Petr



[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