[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200526150114.GB75990@rocinante>
Date: Tue, 26 May 2020 17:01:14 +0200
From: Krzysztof WilczyĆski <kw@...ux.com>
To: Alex Elder <elder@...aro.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
linux-pci@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Pavel Machek <pavel@....cz>, linux-s390@...r.kernel.org,
linux-scsi@...r.kernel.org, Kevin Hilman <khilman@...nel.org>,
Julian Wiedmann <jwi@...ux.ibm.com>,
linux-acpi@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
Len Brown <lenb@...nel.org>, linux-pm@...r.kernel.org,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Ursula Braun <ubraun@...ux.ibm.com>,
Johan Hovold <johan@...nel.org>, greybus-dev@...ts.linaro.org,
John Stultz <john.stultz@...aro.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Felipe Balbi <balbi@...nel.org>, Alex Elder <elder@...nel.org>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
netdev@...r.kernel.org, linux-usb@...r.kernel.org,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Karsten Graul <kgraul@...ux.ibm.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [greybus-dev] [PATCH 1/8] driver core: Add helper for accessing
Power Management callbacs
Hello Alex and Greg,
[...]
> This could just be:
>
> if (drv)
> return drv->pm;
>
> return NULL;
>
> Or if you want to evoke passion in Greg:
>
> return drv ? drv->pm : NULL;
>
> -Alex
>
> > I hate ? : lines with a passion, as they break normal pattern mattching
> > in my brain. Please just spell this all out:
> > if (drv && drv->pm)
> > return drv->pm;
> > return NULL;
> >
> > Much easier to read, and the compiler will do the exact same thing.
> >
> > Only place ? : are ok to use in my opinion, are as function arguments.
I will steer away from the ternary operator next time. Also, good to
learn about Greg's preference.
Thank you both!
Krzysztof
Powered by blists - more mailing lists