All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	kernel@stlinux.com,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Angus CLARK <angus.clark@st.com>
Subject: Re: [PATCH 1/5] mtd: st_spi_fsm: Remove useless consts from function arguments
Date: Thu, 20 Mar 2014 05:41:00 -0700	[thread overview]
Message-ID: <CAN8TOE9g2VwVgVx1Sj3OcguuwP_A9pJS+WpgTAL49KyN9r1CiA@mail.gmail.com> (raw)
In-Reply-To: <1395317630.7776.29.camel@joe-AO722>

On Thu, Mar 20, 2014 at 5:13 AM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2014-03-20 at 12:03 +0000, Lee Jones wrote:
>> > Good catch. That wasn't my intention.
>> > > Why?
>> An oversight.
>
> That's still not an explanation.
>
> Why, unless cast away by the code itself, is
> const removal a good thing?

It's not so much removal as it is review of the initial driver merge.
I'd contend that const was applied somewhat thoughtlessly originally,
and it didn't really serve a good purpose.

> It does serve as an indication to a reader what
> the code does with the argument.
>
> About the only reason I can think of arguing in
> favor of removal is inconsistent application of
> const within the module.

That's one good reason. And not only consistency within the modules,
but consistency within the subsystem (and the kernel at large,
really). There's rarely a case of a const function parameter. And I'm
sure there are numerous function parameters which could potentially be
marked 'const'.

I also don't think that a function parameter is the right place to
mark const like this. Function arguments are always pass-by-value, so
this 'const' tells users (callers) nothing useful. It only provides
useless constraints on what the function can do with its copy of the
parameter.

Brian

WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Angus CLARK <angus.clark@st.com>,
	kernel@stlinux.com, Lee Jones <lee.jones@linaro.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/5] mtd: st_spi_fsm: Remove useless consts from function arguments
Date: Thu, 20 Mar 2014 05:41:00 -0700	[thread overview]
Message-ID: <CAN8TOE9g2VwVgVx1Sj3OcguuwP_A9pJS+WpgTAL49KyN9r1CiA@mail.gmail.com> (raw)
In-Reply-To: <1395317630.7776.29.camel@joe-AO722>

On Thu, Mar 20, 2014 at 5:13 AM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2014-03-20 at 12:03 +0000, Lee Jones wrote:
>> > Good catch. That wasn't my intention.
>> > > Why?
>> An oversight.
>
> That's still not an explanation.
>
> Why, unless cast away by the code itself, is
> const removal a good thing?

It's not so much removal as it is review of the initial driver merge.
I'd contend that const was applied somewhat thoughtlessly originally,
and it didn't really serve a good purpose.

> It does serve as an indication to a reader what
> the code does with the argument.
>
> About the only reason I can think of arguing in
> favor of removal is inconsistent application of
> const within the module.

That's one good reason. And not only consistency within the modules,
but consistency within the subsystem (and the kernel at large,
really). There's rarely a case of a const function parameter. And I'm
sure there are numerous function parameters which could potentially be
marked 'const'.

I also don't think that a function parameter is the right place to
mark const like this. Function arguments are always pass-by-value, so
this 'const' tells users (callers) nothing useful. It only provides
useless constraints on what the function can do with its copy of the
parameter.

Brian

WARNING: multiple messages have this Message-ID (diff)
From: computersforpeace@gmail.com (Brian Norris)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] mtd: st_spi_fsm: Remove useless consts from function arguments
Date: Thu, 20 Mar 2014 05:41:00 -0700	[thread overview]
Message-ID: <CAN8TOE9g2VwVgVx1Sj3OcguuwP_A9pJS+WpgTAL49KyN9r1CiA@mail.gmail.com> (raw)
In-Reply-To: <1395317630.7776.29.camel@joe-AO722>

On Thu, Mar 20, 2014 at 5:13 AM, Joe Perches <joe@perches.com> wrote:
> On Thu, 2014-03-20 at 12:03 +0000, Lee Jones wrote:
>> > Good catch. That wasn't my intention.
>> > > Why?
>> An oversight.
>
> That's still not an explanation.
>
> Why, unless cast away by the code itself, is
> const removal a good thing?

It's not so much removal as it is review of the initial driver merge.
I'd contend that const was applied somewhat thoughtlessly originally,
and it didn't really serve a good purpose.

> It does serve as an indication to a reader what
> the code does with the argument.
>
> About the only reason I can think of arguing in
> favor of removal is inconsistent application of
> const within the module.

That's one good reason. And not only consistency within the modules,
but consistency within the subsystem (and the kernel at large,
really). There's rarely a case of a const function parameter. And I'm
sure there are numerous function parameters which could potentially be
marked 'const'.

I also don't think that a function parameter is the right place to
mark const like this. Function arguments are always pass-by-value, so
this 'const' tells users (callers) nothing useful. It only provides
useless constraints on what the function can do with its copy of the
parameter.

Brian

  reply	other threads:[~2014-03-20 12:41 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 11:11 [PATCH 0/5] mtd: st_spi_fsm: Sweep-up remaining blocking-issues Lee Jones
2014-03-20 11:11 ` Lee Jones
2014-03-20 11:11 ` Lee Jones
2014-03-20 11:11 ` [PATCH 1/5] mtd: st_spi_fsm: Remove useless consts from function arguments Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:25   ` Joe Perches
2014-03-20 11:25     ` Joe Perches
2014-03-20 11:25     ` Joe Perches
2014-03-20 11:41     ` Lee Jones
2014-03-20 11:41       ` Lee Jones
2014-03-20 11:41       ` Lee Jones
2014-03-20 11:48       ` Joe Perches
2014-03-20 11:48         ` Joe Perches
2014-03-20 11:48         ` Joe Perches
2014-03-20 11:54         ` Brian Norris
2014-03-20 11:54           ` Brian Norris
2014-03-20 11:54           ` Brian Norris
2014-03-20 12:03           ` Lee Jones
2014-03-20 12:03             ` Lee Jones
2014-03-20 12:03             ` Lee Jones
2014-03-20 12:05             ` Brian Norris
2014-03-20 12:05               ` Brian Norris
2014-03-20 12:05               ` Brian Norris
2014-03-20 12:13             ` Joe Perches
2014-03-20 12:13               ` Joe Perches
2014-03-20 12:13               ` Joe Perches
2014-03-20 12:41               ` Brian Norris [this message]
2014-03-20 12:41                 ` Brian Norris
2014-03-20 12:41                 ` Brian Norris
2014-03-20 12:44                 ` Joe Perches
2014-03-20 12:44                   ` Joe Perches
2014-03-20 12:44                   ` Joe Perches
2014-03-20 16:58                   ` Brian Norris
2014-03-20 16:58                     ` Brian Norris
2014-03-20 16:58                     ` Brian Norris
2014-03-20 13:29               ` Lee Jones
2014-03-20 13:29                 ` Lee Jones
2014-03-20 13:29                 ` Lee Jones
2014-03-20 11:11 ` [PATCH 2/5] mtd: st_spi_fsm: Avoid duplicating MTD core code Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11 ` [PATCH 3/5] mtd: st_spi_fsm: Correct vendor name spelling issue - missing "M" Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11 ` [PATCH 4/5] mtd: st_spi_fsm: Allow loop to run at least once before giving up CPU Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11 ` [PATCH 5/5] mtd: st_spi_fsm: Succinctly reorganise .remove() Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:11   ` Lee Jones
2014-03-20 11:29 ` [PATCH 0/5] mtd: st_spi_fsm: Sweep-up remaining blocking-issues Brian Norris
2014-03-20 11:29   ` Brian Norris
2014-03-20 11:29   ` Brian Norris

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=CAN8TOE9g2VwVgVx1Sj3OcguuwP_A9pJS+WpgTAL49KyN9r1CiA@mail.gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=angus.clark@st.com \
    --cc=dwmw2@infradead.org \
    --cc=joe@perches.com \
    --cc=kernel@stlinux.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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 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.