All of lore.kernel.org
 help / color / mirror / Atom feed
* rtl8192e: need help with variable naming convention
@ 2019-01-07 10:34 Himadri Pandya
  2019-01-07 10:45 ` Himadri Pandya
  2019-01-07 10:52 ` Greg KH
  0 siblings, 2 replies; 10+ messages in thread
From: Himadri Pandya @ 2019-01-07 10:34 UTC (permalink / raw)
  To: driverdev-devel; +Cc: gregkh

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

Hello,

I'm getting started with device drivers. And as a starter, I'm working on
some clean-up patches.  I'm particularly targeting to rename a structure
array "ChannelPlan"(in file dot11d.c) to fix a checkpatch.pl warning "Avoid
CamelCase". According to the coding style, it should be converted to
"channel_plan". But the code contains a function argument with the same
name "channel_plan". Should I then rename the array to something like
"channel_name_"? I'm sorry for asking such a silly question. But I want to
know if renaming it in such a ways fits in the convention before I make the
change.

Thank you.

- Himadri

[-- Attachment #2: Type: text/html, Size: 824 bytes --]

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-07 10:34 rtl8192e: need help with variable naming convention Himadri Pandya
@ 2019-01-07 10:45 ` Himadri Pandya
  2019-01-07 10:52 ` Greg KH
  1 sibling, 0 replies; 10+ messages in thread
From: Himadri Pandya @ 2019-01-07 10:45 UTC (permalink / raw)
  To: driverdev-devel; +Cc: gregkh

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

On Mon, Jan 7, 2019 at 4:04 PM Himadri Pandya <himadri18.07@gmail.com>
wrote:

>  Should I then rename the array to something like "channel_name_"? I'm
> sorry for asking such a silly question. But I want to know if renaming it
> in such a ways fits in the convention before I make the change.
>

My bad. I meant should I then rename the array to something like
"channel_plan_"?

[-- Attachment #2: Type: text/html, Size: 739 bytes --]

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-07 10:34 rtl8192e: need help with variable naming convention Himadri Pandya
  2019-01-07 10:45 ` Himadri Pandya
@ 2019-01-07 10:52 ` Greg KH
  2019-01-07 13:03   ` Dan Carpenter
  2019-01-13  6:26   ` Himadri Pandya
  1 sibling, 2 replies; 10+ messages in thread
From: Greg KH @ 2019-01-07 10:52 UTC (permalink / raw)
  To: Himadri Pandya; +Cc: driverdev-devel

On Mon, Jan 07, 2019 at 04:04:46PM +0530, Himadri Pandya wrote:
> Hello,
> 
> I'm getting started with device drivers. And as a starter, I'm working on
> some clean-up patches.  I'm particularly targeting to rename a structure
> array "ChannelPlan"(in file dot11d.c) to fix a checkpatch.pl warning "Avoid
> CamelCase". According to the coding style, it should be converted to
> "channel_plan". But the code contains a function argument with the same
> name "channel_plan". Should I then rename the array to something like
> "channel_name_"? I'm sorry for asking such a silly question. But I want to
> know if renaming it in such a ways fits in the convention before I make the
> change.

A structure name is different from a function name, so odds are you can
just do this with no problems.  Try it and find out!

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-07 10:52 ` Greg KH
@ 2019-01-07 13:03   ` Dan Carpenter
  2019-01-13  6:31     ` Himadri Pandya
  2019-01-13  6:26   ` Himadri Pandya
  1 sibling, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2019-01-07 13:03 UTC (permalink / raw)
  To: Greg KH; +Cc: driverdev-devel

On Mon, Jan 07, 2019 at 11:52:14AM +0100, Greg KH wrote:
> On Mon, Jan 07, 2019 at 04:04:46PM +0530, Himadri Pandya wrote:
> > Hello,
> > 
> > I'm getting started with device drivers. And as a starter, I'm working on
> > some clean-up patches.  I'm particularly targeting to rename a structure
> > array "ChannelPlan"(in file dot11d.c) to fix a checkpatch.pl warning "Avoid
> > CamelCase". According to the coding style, it should be converted to
> > "channel_plan". But the code contains a function argument with the same
> > name "channel_plan". Should I then rename the array to something like
> > "channel_name_"?


Ending a name with an underscore is quite ugly.  Feel free to get more
creative with the naming scheme.  Rethink things as much as you can,
don't assume the original code is something to copy.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-07 10:52 ` Greg KH
  2019-01-07 13:03   ` Dan Carpenter
@ 2019-01-13  6:26   ` Himadri Pandya
  1 sibling, 0 replies; 10+ messages in thread
From: Himadri Pandya @ 2019-01-13  6:26 UTC (permalink / raw)
  To: Greg KH; +Cc: driverdev-devel

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

Tried but it resulted in a compilation error. So renaming it with a
different name (channel_array[ ]) instead.

Thank you.

- Himadri

On Mon, Jan 7, 2019 at 2:52 AM Greg KH <gregkh@linuxfoundation.org> wrote:

> On Mon, Jan 07, 2019 at 04:04:46PM +0530, Himadri Pandya wrote:
> > Hello,
> >
> > I'm getting started with device drivers. And as a starter, I'm working on
> > some clean-up patches.  I'm particularly targeting to rename a structure
> > array "ChannelPlan"(in file dot11d.c) to fix a checkpatch.pl warning
> "Avoid
> > CamelCase". According to the coding style, it should be converted to
> > "channel_plan". But the code contains a function argument with the same
> > name "channel_plan". Should I then rename the array to something like
> > "channel_name_"? I'm sorry for asking such a silly question. But I want
> to
> > know if renaming it in such a ways fits in the convention before I make
> the
> > change.
>
> A structure name is different from a function name, so odds are you can
> just do this with no problems.  Try it and find out!
>
> greg k-h
>

[-- Attachment #2: Type: text/html, Size: 1610 bytes --]

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-07 13:03   ` Dan Carpenter
@ 2019-01-13  6:31     ` Himadri Pandya
  2019-01-14 10:51       ` Dan Carpenter
  0 siblings, 1 reply; 10+ messages in thread
From: Himadri Pandya @ 2019-01-13  6:31 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

On Mon, Jan 7, 2019 at 5:04 AM Dan Carpenter <dan.carpenter@oracle.com>
wrote:

>
> Ending a name with an underscore is quite ugly.


Yeah. That's right. So renaming it to channel_array[ ] instead.


> Feel free to get more
> creative with the naming scheme.  Rethink things as much as you can,
> don't assume the original code is something to copy.
>

I wasn't sure if I'm allowed to do so. Thank you for letting me know.

- Himadri

[-- Attachment #2: Type: text/html, Size: 966 bytes --]

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-13  6:31     ` Himadri Pandya
@ 2019-01-14 10:51       ` Dan Carpenter
  2019-01-14 12:09         ` Himadri Pandya
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2019-01-14 10:51 UTC (permalink / raw)
  To: Himadri Pandya; +Cc: Greg KH, driverdev-devel

On Sat, Jan 12, 2019 at 10:31:08PM -0800, Himadri Pandya wrote:
> On Mon, Jan 7, 2019 at 5:04 AM Dan Carpenter <dan.carpenter@oracle.com>
> wrote:
> 
> >
> > Ending a name with an underscore is quite ugly.
> 
> 
> Yeah. That's right. So renaming it to channel_array[ ] instead.
> 

Naming is hard.  Having "_array" in the name isn't great either.  It's
normally obvious it's an array because of the [] characters.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-14 10:51       ` Dan Carpenter
@ 2019-01-14 12:09         ` Himadri Pandya
  2019-01-14 12:37           ` Dan Carpenter
  0 siblings, 1 reply; 10+ messages in thread
From: Himadri Pandya @ 2019-01-14 12:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

On Mon, 14 Jan, 2019, 4:21 PM Dan Carpenter <dan.carpenter@oracle.com wrote:

Naming is hard.  Having "_array" in the name isn't great either.  It's
> normally obvious it's an array because of the [] characters.
>

Okay. How about renaming it to "_list[ ]" ? But I'm not sure if calling it
a list will introduce redundancy or increase readability by showing we're
implementing a list with an array?

- Himadri

>

[-- Attachment #2: Type: text/html, Size: 998 bytes --]

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-14 12:09         ` Himadri Pandya
@ 2019-01-14 12:37           ` Dan Carpenter
  2019-01-15  8:03             ` Himadri Pandya
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2019-01-14 12:37 UTC (permalink / raw)
  To: Himadri Pandya; +Cc: Greg KH, driverdev-devel

On Mon, Jan 14, 2019 at 05:39:24PM +0530, Himadri Pandya wrote:
> On Mon, 14 Jan, 2019, 4:21 PM Dan Carpenter <dan.carpenter@oracle.com wrote:
> 
> Naming is hard.  Having "_array" in the name isn't great either.  It's
> > normally obvious it's an array because of the [] characters.
> >
> 
> Okay. How about renaming it to "_list[ ]" ? But I'm not sure if calling it
> a list will introduce redundancy or increase readability by showing we're
> implementing a list with an array?

_list is fine.  Or _array is fine, really.  Even channal_plan[] seems
Ok to me.  Something that mentions region, perhaps?  It's all fine.

So long as you're thinking about naming and trying to say something
then it's probably fine.  We're not trying to be ogres or to reject
patches.

regards,
dan carpenter

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

* Re: rtl8192e: need help with variable naming convention
  2019-01-14 12:37           ` Dan Carpenter
@ 2019-01-15  8:03             ` Himadri Pandya
  0 siblings, 0 replies; 10+ messages in thread
From: Himadri Pandya @ 2019-01-15  8:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdev-devel

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On Mon, Jan 14, 2019 at 6:07 PM Dan Carpenter <dan.carpenter@oracle.com>
wrote:

> On Mon, Jan 14, 2019 at 05:39:24PM +0530, Himadri Pandya wrote:
> > On Mon, 14 Jan, 2019, 4:21 PM Dan Carpenter <dan.carpenter@oracle.com
> wrote:
> >
> > Naming is hard.  Having "_array" in the name isn't great either.  It's
> > > normally obvious it's an array because of the [] characters.
> > >
> >
> > Okay. How about renaming it to "_list[ ]" ? But I'm not sure if calling
> it
> > a list will introduce redundancy or increase readability by showing we're
> > implementing a list with an array?
>
> _list is fine.  Or _array is fine, really.  Even channal_plan[] seems
> Ok to me.  Something that mentions region, perhaps?  It's all fine.
>

Alright. keeping it _array then.


>
> So long as you're thinking about naming and trying to say something
> then it's probably fine.  We're not trying to be ogres or to reject
> patches.
>

It's fine. In fact, I really appreciate your remarks. It helped me in
better understanding significance of meaningful variable names. Thank you.

- Himadri

[-- Attachment #2: Type: text/html, Size: 1801 bytes --]

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

end of thread, other threads:[~2019-01-15  8:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 10:34 rtl8192e: need help with variable naming convention Himadri Pandya
2019-01-07 10:45 ` Himadri Pandya
2019-01-07 10:52 ` Greg KH
2019-01-07 13:03   ` Dan Carpenter
2019-01-13  6:31     ` Himadri Pandya
2019-01-14 10:51       ` Dan Carpenter
2019-01-14 12:09         ` Himadri Pandya
2019-01-14 12:37           ` Dan Carpenter
2019-01-15  8:03             ` Himadri Pandya
2019-01-13  6:26   ` Himadri Pandya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.