From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Johan Hovold <johan@kernel.org>,
mrossibellom@gmail.com, elder@kernel.org,
gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] greybus: Fix coding stye error
Date: Fri, 27 Jan 2017 14:53:15 +0100 [thread overview]
Message-ID: <20170127135315.GI3560@localhost> (raw)
In-Reply-To: <20170127132447.GQ4201@mwanda>
On Fri, Jan 27, 2017 at 04:24:47PM +0300, Dan Carpenter wrote:
> On Fri, Jan 27, 2017 at 02:08:06PM +0100, Johan Hovold wrote:
> > On Fri, Jan 27, 2017 at 03:47:21PM +0300, Dan Carpenter wrote:
> > > The name sucks is what I'm saying. Please fix it eventually.
> >
> > I disagree. The name uses a common prefix that reflects the object it is
> > working on. This should not be changed. As it is currently named, the
> > function is also self-documenting. Trying to abbreviate the name just to
> > meet a 80 col limit (when there are alternatives) is just silly.
>
> gb_interface_request_mode_switch()
>
> It's not self documenting because there are no verbs in that sentence.
"request" is a verb.
We're requesting that the remote interface initiates a mode switch
(something which it can refuse).
It's a function that is only a called a couple of times. No need to
rewrite it as gb_intf_rms() or such (even if gb_intf would be a
reasonable prefix).
You comments about missing verbs etc make me wonder how you parse the
name:
gb_interface - a common prefix, indicating object
being acted on
request_mode_switch - describes what is done
we're not fetching anything as your "gb_get_mode_switch()" suggestion
indicates you read it as.
> I guess in JAVA it would be considered good style.
>
> This is "Enterprise Quality" in the derogatory sense of the term. The
> prefix makes everything too long and doesn't add any value. We don't
> keep the 80 character limit because of small screens, we keep it to
> discourage this type of code.
And to keep indentation down.
The kernel already has similar function names such as
"usb_driver_set_configuration" or "pm_runtime_mark_last_busy" which
follow the same pattern (prefix - verb - object).
Johan
next prev parent reply other threads:[~2017-01-27 14:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-27 10:11 [PATCH] greybus: Fix coding stye error mrossibellom
2017-01-27 10:17 ` Greg KH
2017-01-27 12:29 ` Dan Carpenter
2017-01-27 12:39 ` Johan Hovold
2017-01-27 12:47 ` Dan Carpenter
2017-01-27 13:08 ` Johan Hovold
2017-01-27 13:24 ` Dan Carpenter
2017-01-27 13:53 ` Johan Hovold [this message]
2017-01-27 14:13 ` Dan Carpenter
2017-01-27 14:37 ` Maxime Rossi Bellom
2017-01-27 14:43 ` Dan Carpenter
2017-01-27 14:46 ` Maxime Rossi Bellom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170127135315.GI3560@localhost \
--to=johan@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mrossibellom@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox