linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC]coding style for NULL pointer checks
@ 2014-02-16 12:19 Hartmut Knaack
  2014-02-16 18:56 ` Lars-Peter Clausen
  0 siblings, 1 reply; 7+ messages in thread
From: Hartmut Knaack @ 2014-02-16 12:19 UTC (permalink / raw)
  To: linux-iio

Hi together,
I noticed, that many pointers in the IIO subsystem are checked for successful allocation in the way of "if (pointer == NULL)" or "if (pointer != NULL)", while in a few cases the form of simply "if (!pointer)" or "if (pointer)" is used. So, is there any interest in having a more consistent style, and if so, for which one?
My personal preference is for the latter one.
Thanks

Hartmut

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-16 12:19 [RFC]coding style for NULL pointer checks Hartmut Knaack
@ 2014-02-16 18:56 ` Lars-Peter Clausen
  2014-02-18  8:40   ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-02-16 18:56 UTC (permalink / raw)
  To: Hartmut Knaack; +Cc: linux-iio

On 02/16/2014 01:19 PM, Hartmut Knaack wrote:
> Hi together,
> I noticed, that many pointers in the IIO subsystem are checked for successful allocation in the way of "if (pointer == NULL)" or "if (pointer != NULL)", while in a few cases the form of simply "if (!pointer)" or "if (pointer)" is used. So, is there any interest in having a more consistent style, and if so, for which one?
> My personal preference is for the latter one.

I think enforcing this is a bit to much nitpicking. So if you clean this up the 
other pattern will probably appear again in new drivers at some point.

Otherwise, if you feel strongly about this, go ahead and send a patch.

- Lars


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-16 18:56 ` Lars-Peter Clausen
@ 2014-02-18  8:40   ` Jonathan Cameron
  2014-02-19 22:54     ` Hartmut Knaack
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2014-02-18  8:40 UTC (permalink / raw)
  To: Lars-Peter Clausen, Hartmut Knaack; +Cc: linux-iio

On 16/02/14 18:56, Lars-Peter Clausen wrote:
> On 02/16/2014 01:19 PM, Hartmut Knaack wrote:
>> Hi together,
>> I noticed, that many pointers in the IIO subsystem are checked for successful allocation in the way of "if (pointer == NULL)" or "if (pointer != NULL)", while in a few cases the form of simply "if (!pointer)" or "if (pointer)" is used. So, is there any interest in having a more consistent style, and if so, for which one?
>> My personal preference is for the latter one.
>
> I think enforcing this is a bit to much nitpicking. So if you clean this up the other pattern will probably appear again in new drivers at some point.
>
> Otherwise, if you feel strongly about this, go ahead and send a patch.
My inclination on this is that there are better things to spend time on
but as they say scratch the itch if you really want to!

I'd rather have the nice error patch cleanups you've been doing or
if you are really bored, there are lots of staging drivers in need of
tendour loving care!

J



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-18  8:40   ` Jonathan Cameron
@ 2014-02-19 22:54     ` Hartmut Knaack
  2014-02-20  9:04       ` Lars-Peter Clausen
  2014-02-20 18:55       ` Jonathan Cameron
  0 siblings, 2 replies; 7+ messages in thread
From: Hartmut Knaack @ 2014-02-19 22:54 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen; +Cc: linux-iio

Jonathan Cameron schrieb:
> On 16/02/14 18:56, Lars-Peter Clausen wrote:
>> On 02/16/2014 01:19 PM, Hartmut Knaack wrote:
>>> Hi together,
>>> I noticed, that many pointers in the IIO subsystem are checked for successful allocation in the way of "if (pointer == NULL)" or "if (pointer != NULL)", while in a few cases the form of simply "if (!pointer)" or "if (pointer)" is used. So, is there any interest in having a more consistent style, and if so, for which one?
>>> My personal preference is for the latter one.
>> I think enforcing this is a bit to much nitpicking. So if you clean this up the other pattern will probably appear again in new drivers at some point.
>>
>> Otherwise, if you feel strongly about this, go ahead and send a patch.
> My inclination on this is that there are better things to spend time on
> but as they say scratch the itch if you really want to!
>
> I'd rather have the nice error patch cleanups you've been doing or
> if you are really bored, there are lots of staging drivers in need of
> tendour loving care!
>
> J
Well, never mind then. Do you have some kind of To-Do-List? Otherwise I would get back to my other projects.
Concerning the staging drivers, I miss some motivation to work on device drivers that I don't have the devices for. Therefor I was mainly focusing on the ad799x. So, by the way, which are currently the show-stoppers for the ad799x preventing a move out of staging?
And, are there any plans to provide documentation about the supported IIO devices (similar to hwmon)?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-19 22:54     ` Hartmut Knaack
@ 2014-02-20  9:04       ` Lars-Peter Clausen
  2014-02-20 18:55       ` Jonathan Cameron
  1 sibling, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-02-20  9:04 UTC (permalink / raw)
  To: Hartmut Knaack; +Cc: Jonathan Cameron, linux-iio

On 02/19/2014 11:54 PM, Hartmut Knaack wrote:
[...]
> Concerning the staging drivers, I miss some motivation to work on device drivers that I don't have the devices for. Therefor I was mainly focusing on the ad799x. So, by the way, which are currently the show-stoppers for the ad799x preventing a move out of staging?
[...]

No, that was the last blocker, I do have a patch that moves it out of 
staging, will submit it soon.

- Lars



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-19 22:54     ` Hartmut Knaack
  2014-02-20  9:04       ` Lars-Peter Clausen
@ 2014-02-20 18:55       ` Jonathan Cameron
  2014-02-20 19:13         ` Lars-Peter Clausen
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2014-02-20 18:55 UTC (permalink / raw)
  To: Hartmut Knaack, Lars-Peter Clausen; +Cc: linux-iio

On 19/02/14 22:54, Hartmut Knaack wrote:
> Jonathan Cameron schrieb:
>> On 16/02/14 18:56, Lars-Peter Clausen wrote:
>>> On 02/16/2014 01:19 PM, Hartmut Knaack wrote:
>>>> Hi together,
>>>> I noticed, that many pointers in the IIO subsystem are checked for successful allocation in the way of "if (pointer == NULL)" or "if (pointer != NULL)", while in a few cases the form of simply "if (!pointer)" or "if (pointer)" is used. So, is there any interest in having a more consistent style, and if so, for which one?
>>>> My personal preference is for the latter one.
>>> I think enforcing this is a bit to much nitpicking. So if you clean this up the other pattern will probably appear again in new drivers at some point.
>>>
>>> Otherwise, if you feel strongly about this, go ahead and send a patch.
>> My inclination on this is that there are better things to spend time on
>> but as they say scratch the itch if you really want to!
>>
>> I'd rather have the nice error patch cleanups you've been doing or
>> if you are really bored, there are lots of staging drivers in need of
>> tendour loving care!
>>
>> J
> Well, never mind then. Do you have some kind of To-Do-List?
Saddly I / we are never quite that organised.  Tends to be mostly take
a nice cleanup that was applied to a driver and propagate it across similar
parts.  One outstanding one right now is to use the shared_by infomask
elements recently introduced (by_dir and by_all) to get rid of as many
hand specified attributes as possible.  The other big helpful thing
is to review other peoples submissions.
> Otherwise I would get back to my other projects.
That's fair enough.  Nice to have some variety!
> Concerning the staging drivers, I miss some motivation to work on
> device drivers that I don't have the devices for.
That's fair enough.  Strangely I can't remember when I last did any
work on a device I actually own ;)  Still have a quite a few here
somewhere that don't have drivers, but need to get the soldering iron out
and never seem to get time.
>Therefor I was  mainly focusing on the ad799x. So, by the way, which are currently the show-stoppers for the ad799x preventing a move out of staging?
None that I know of, other than a final review.  Sounds like Lars is happy which
is always a good sign.
> And, are there any plans to provide documentation about the supported IIO devices (similar to hwmon)?
Err. we tried this for a bit on the iio-utils wiki page, but rapidly got
left behind.

I guess it might be a useful resource if anyone fancies maintaining it?
>
> Hartmut
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC]coding style for NULL pointer checks
  2014-02-20 18:55       ` Jonathan Cameron
@ 2014-02-20 19:13         ` Lars-Peter Clausen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-02-20 19:13 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Hartmut Knaack, linux-iio

On 02/20/2014 07:55 PM, Jonathan Cameron wrote:
> On 19/02/14 22:54, Hartmut Knaack wrote:
>> Jonathan Cameron schrieb:
>>> On 16/02/14 18:56, Lars-Peter Clausen wrote:
>>>> On 02/16/2014 01:19 PM, Hartmut Knaack wrote:
>>>>> Hi together,
>>>>> I noticed, that many pointers in the IIO subsystem are checked for
>>>>> successful allocation in the way of "if (pointer == NULL)" or "if (pointer
>>>>> != NULL)", while in a few cases the form of simply "if (!pointer)" or "if
>>>>> (pointer)" is used. So, is there any interest in having a more consistent
>>>>> style, and if so, for which one?
>>>>> My personal preference is for the latter one.
>>>> I think enforcing this is a bit to much nitpicking. So if you clean this up
>>>> the other pattern will probably appear again in new drivers at some point.
>>>>
>>>> Otherwise, if you feel strongly about this, go ahead and send a patch.
>>> My inclination on this is that there are better things to spend time on
>>> but as they say scratch the itch if you really want to!
>>>
>>> I'd rather have the nice error patch cleanups you've been doing or
>>> if you are really bored, there are lots of staging drivers in need of
>>> tendour loving care!
>>>
>>> J
>> Well, never mind then. Do you have some kind of To-Do-List?
> Saddly I / we are never quite that organised.  Tends to be mostly take
> a nice cleanup that was applied to a driver and propagate it across similar
> parts.  One outstanding one right now is to use the shared_by infomask
> elements recently introduced (by_dir and by_all) to get rid of as many
> hand specified attributes as possible.  The other big helpful thing
> is to review other peoples submissions.
>> Otherwise I would get back to my other projects.
> That's fair enough.  Nice to have some variety!
>> Concerning the staging drivers, I miss some motivation to work on
>> device drivers that I don't have the devices for.
> That's fair enough.  Strangely I can't remember when I last did any
> work on a device I actually own ;)  Still have a quite a few here
> somewhere that don't have drivers, but need to get the soldering iron out
> and never seem to get time.
>> Therefor I was  mainly focusing on the ad799x. So, by the way, which are
>> currently the show-stoppers for the ad799x preventing a move out of staging?
> None that I know of, other than a final review.  Sounds like Lars is happy which
> is always a good sign.
>> And, are there any plans to provide documentation about the supported IIO
>> devices (similar to hwmon)?
> Err. we tried this for a bit on the iio-utils wiki page, but rapidly got
> left behind.
>
> I guess it might be a useful resource if anyone fancies maintaining it?

For the ADI drivers we actually do have quite a bit of documentation. But it is 
not in the kernel tree, but on our wiki: 
http://wiki.analog.com/resources/tools-software/linux-drivers-all

- Lars

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-20 19:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 12:19 [RFC]coding style for NULL pointer checks Hartmut Knaack
2014-02-16 18:56 ` Lars-Peter Clausen
2014-02-18  8:40   ` Jonathan Cameron
2014-02-19 22:54     ` Hartmut Knaack
2014-02-20  9:04       ` Lars-Peter Clausen
2014-02-20 18:55       ` Jonathan Cameron
2014-02-20 19:13         ` Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).