Re: [PATCH v1 1/1] software node: Simplify swnode_register() a bit

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

 



On Fri, Sep 13, 2024 at 03:34:58PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Sep 13, 2024 at 02:05:23PM +0300, Andy Shevchenko wrote:

...

> > +	struct kobject *kobj_parent = parent ? &parent->kobj : NULL;
> 
> I despise ?: use just so much, EXCEPT for when it's used in something
> like this:

> >  		ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
> > -					   parent ? &parent->kobj : NULL,
> > -					   "%s", node->name);
> > +					   kobj_parent, "%s", node->name);
> 
> Which really is the only valid way I'd put up with it :)

I see your point!

> So can you rewrite the change above to be just:
> 
> 	struct kobject *kobj_parent = NULL;
> 
> 	...
> 
> 	if (parent)
> 		kobj_parent = &parent->kobj;
> 
> Which is much simpler to read, right?

Yeah, but the point of the patch seems to be diminished. Let's just not
continue with it for now. Maybe later it will make more sense.

Thank you for the review!

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux