All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Guinot <simon.guinot@sequanux.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>,
	Bryan Wu <cooloney@gmail.com>,
	kernel-janitors@vger.kernel.org,
	Richard Purdie <rpurdie@rpsys.net>,
	linux-arm-kernel@lists.infradead.org,
	Gregory Clement <gregory.clement@free-electrons.com>,
	linux-leds@vger.kernel.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [patch 2/2] leds: netxbig: clean up a data type issue
Date: Fri, 10 Apr 2015 02:25:07 +0200	[thread overview]
Message-ID: <20150410002507.GF1509@kw.sim.vm.gnt> (raw)
In-Reply-To: <20150409195426.GP10964@mwanda>

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

On Thu, Apr 09, 2015 at 10:54:26PM +0300, Dan Carpenter wrote:
> On Thu, Apr 09, 2015 at 09:25:57PM +0200, Simon Guinot wrote:
> > On Thu, Apr 09, 2015 at 12:07:12PM +0300, Dan Carpenter wrote:
> > > This driver is pretty hardware specific so it's unlikely that we're
> > > going to be using it on 64 big endian systems.  Still, the current code
> > > causes a static checker warning so we may as well change the type from
> > > "unsigned long" to "u32" and remove the casting.
> > 
> > Hi Dan,
> > 
> > Thanks for the patch.
> > 
> > Why do you think it would be an issue to use the u32 type for this
> > variables on a 64-bit big-endian machine ? Note that this LED mechanism
> > is actually used on ARM 32-bits and x86-64 NAS platforms. The latter are
> > not mainlined yet. But indeed, for now, there is no plan to use it on a
> > 64-bit big-endian machine.
> > 
> > Since the whole LED code uses the unsigned long type to hold the delay
> > values, if possible, I would prefer to keep the delay_{on,off} variables
> > consistent with that.
> > 
> > Is there an another way to make the "static checker" happy ?
> 
> We're writing over 32 bits of a long.  It's a dangerous habbit.
> 
> If long is u32 then of_property_read_u32_index() works, obviously.  If
> it is a little endian and the last 32 bits have been zeroed out (as they
> have been here) then that also works.
> 
> If it's big endian and 64 bit then it doesn't work because we're writing
> to the wrong 32 bits.

Sorry, I misunderstood your commit message.

But still, rather than changing the type from unsigned long to u32 for
the delay_{on,off} variables, I think we should use a temporary u32
variable for the of_property_read_u32_index calls. This way we can keep
the type of the delay_{on,off} variables consistent with the LED core
code.

Regards,

Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Simon Guinot <simon.guinot@sequanux.org>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [patch 2/2] leds: netxbig: clean up a data type issue
Date: Fri, 10 Apr 2015 00:25:07 +0000	[thread overview]
Message-ID: <20150410002507.GF1509@kw.sim.vm.gnt> (raw)
In-Reply-To: <20150409195426.GP10964@mwanda>

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

On Thu, Apr 09, 2015 at 10:54:26PM +0300, Dan Carpenter wrote:
> On Thu, Apr 09, 2015 at 09:25:57PM +0200, Simon Guinot wrote:
> > On Thu, Apr 09, 2015 at 12:07:12PM +0300, Dan Carpenter wrote:
> > > This driver is pretty hardware specific so it's unlikely that we're
> > > going to be using it on 64 big endian systems.  Still, the current code
> > > causes a static checker warning so we may as well change the type from
> > > "unsigned long" to "u32" and remove the casting.
> > 
> > Hi Dan,
> > 
> > Thanks for the patch.
> > 
> > Why do you think it would be an issue to use the u32 type for this
> > variables on a 64-bit big-endian machine ? Note that this LED mechanism
> > is actually used on ARM 32-bits and x86-64 NAS platforms. The latter are
> > not mainlined yet. But indeed, for now, there is no plan to use it on a
> > 64-bit big-endian machine.
> > 
> > Since the whole LED code uses the unsigned long type to hold the delay
> > values, if possible, I would prefer to keep the delay_{on,off} variables
> > consistent with that.
> > 
> > Is there an another way to make the "static checker" happy ?
> 
> We're writing over 32 bits of a long.  It's a dangerous habbit.
> 
> If long is u32 then of_property_read_u32_index() works, obviously.  If
> it is a little endian and the last 32 bits have been zeroed out (as they
> have been here) then that also works.
> 
> If it's big endian and 64 bit then it doesn't work because we're writing
> to the wrong 32 bits.

Sorry, I misunderstood your commit message.

But still, rather than changing the type from unsigned long to u32 for
the delay_{on,off} variables, I think we should use a temporary u32
variable for the of_property_read_u32_index calls. This way we can keep
the type of the delay_{on,off} variables consistent with the LED core
code.

Regards,

Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: simon.guinot@sequanux.org (Simon Guinot)
To: linux-arm-kernel@lists.infradead.org
Subject: [patch 2/2] leds: netxbig: clean up a data type issue
Date: Fri, 10 Apr 2015 02:25:07 +0200	[thread overview]
Message-ID: <20150410002507.GF1509@kw.sim.vm.gnt> (raw)
In-Reply-To: <20150409195426.GP10964@mwanda>

On Thu, Apr 09, 2015 at 10:54:26PM +0300, Dan Carpenter wrote:
> On Thu, Apr 09, 2015 at 09:25:57PM +0200, Simon Guinot wrote:
> > On Thu, Apr 09, 2015 at 12:07:12PM +0300, Dan Carpenter wrote:
> > > This driver is pretty hardware specific so it's unlikely that we're
> > > going to be using it on 64 big endian systems.  Still, the current code
> > > causes a static checker warning so we may as well change the type from
> > > "unsigned long" to "u32" and remove the casting.
> > 
> > Hi Dan,
> > 
> > Thanks for the patch.
> > 
> > Why do you think it would be an issue to use the u32 type for this
> > variables on a 64-bit big-endian machine ? Note that this LED mechanism
> > is actually used on ARM 32-bits and x86-64 NAS platforms. The latter are
> > not mainlined yet. But indeed, for now, there is no plan to use it on a
> > 64-bit big-endian machine.
> > 
> > Since the whole LED code uses the unsigned long type to hold the delay
> > values, if possible, I would prefer to keep the delay_{on,off} variables
> > consistent with that.
> > 
> > Is there an another way to make the "static checker" happy ?
> 
> We're writing over 32 bits of a long.  It's a dangerous habbit.
> 
> If long is u32 then of_property_read_u32_index() works, obviously.  If
> it is a little endian and the last 32 bits have been zeroed out (as they
> have been here) then that also works.
> 
> If it's big endian and 64 bit then it doesn't work because we're writing
> to the wrong 32 bits.

Sorry, I misunderstood your commit message.

But still, rather than changing the type from unsigned long to u32 for
the delay_{on,off} variables, I think we should use a temporary u32
variable for the of_property_read_u32_index calls. This way we can keep
the type of the delay_{on,off} variables consistent with the LED core
code.

Regards,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150410/493f813c/attachment.sig>

  reply	other threads:[~2015-04-10  0:25 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09  9:07 [patch 2/2] leds: netxbig: clean up a data type issue Dan Carpenter
2015-04-09  9:07 ` Dan Carpenter
2015-04-09 19:25 ` Simon Guinot
2015-04-09 19:25   ` Simon Guinot
2015-04-09 19:25   ` Simon Guinot
2015-04-09 19:54   ` Dan Carpenter
2015-04-09 19:54     ` Dan Carpenter
2015-04-09 19:54     ` Dan Carpenter
2015-04-10  0:25     ` Simon Guinot [this message]
2015-04-10  0:25       ` Simon Guinot
2015-04-10  0:25       ` Simon Guinot
2015-04-10  8:30       ` [patch 2/2 v2] leds: netxbig: silence a static checker warning Dan Carpenter
2015-04-10  8:30         ` Dan Carpenter
2015-04-10 14:18         ` Jacek Anaszewski
2015-04-10 14:18           ` Jacek Anaszewski
2015-04-10 14:30           ` Dan Carpenter
2015-04-10 14:30             ` Dan Carpenter
2015-04-10 14:41             ` Simon Guinot
2015-04-10 14:41               ` Simon Guinot
2015-04-10 15:50               ` Dan Carpenter
2015-04-10 15:50                 ` Dan Carpenter
2015-04-10 19:52                 ` Simon Guinot
2015-04-10 19:52                   ` Simon Guinot
2015-04-13  7:35                   ` Jacek Anaszewski
2015-04-13  7:35                     ` Jacek Anaszewski
2015-04-13 10:16                     ` Simon Guinot
2015-04-13 10:16                       ` Simon Guinot
2015-04-13 10:54                       ` Jacek Anaszewski
2015-04-13 10:54                         ` Jacek Anaszewski
2015-04-13 10:16                   ` Dan Carpenter
2015-04-13 10:16                     ` Dan Carpenter
2015-04-10 14:30         ` Simon Guinot
2015-04-10 14:30           ` Simon Guinot
2015-04-13  8:25           ` Gregory CLEMENT
2015-04-13  8:25             ` Gregory CLEMENT
2015-04-13  9:20             ` Simon Guinot
2015-04-13  9:20               ` Simon Guinot

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=20150410002507.GF1509@kw.sim.vm.gnt \
    --to=simon.guinot@sequanux.org \
    --cc=andrew@lunn.ch \
    --cc=cooloney@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=sebastian.hesselbarth@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 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.