Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1264741

Re: [GIT] Sparc

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [GIT] Sparc
Date 2015-11-07 07:10 +0100
Message-ID <qs4Rk-6Xq-1@gated-at.bofh.it> (permalink)
References (1 earlier) <qrDo6-5L5-13@gated-at.bofh.it> <qrDxM-5P4-3@gated-at.bofh.it> <qrDHs-67T-3@gated-at.bofh.it> <qrJ0u-Z9-23@gated-at.bofh.it> <qs2wa-5hC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Sat, 7 Nov 2015, Julian Calaby wrote:

> Hi Julia,
> 
> On Fri, Nov 6, 2015 at 5:44 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > On Fri, 6 Nov 2015, Julian Calaby wrote:
> >
> >> Hi Linus,
> >>
> >> On Fri, Nov 6, 2015 at 11:56 AM, Linus Torvalds
> >> <torvalds@linux-foundation.org> wrote:
> >> > On Thu, Nov 5, 2015 at 4:43 PM, Linus Torvalds
> >> > <torvalds@linux-foundation.org> wrote:
> >> >>
> >> >> Not that this *matters*, but it's a bit odd to have to cast constants
> >> >> to perfectly regular C types.
> >> >
> >> > Looking around with "git grep", there's a few more of these.
> >> >
> >> >  - btrfs seems to like "(unsigned long)-1"
> >> >
> >> >    There's a few other users of that too, including more sparc uses.
> >> >
> >> >  - scsi/qla seems to like "(unsigned long)<hexnumber>"
> >> >
> >> >  - fmdrv_common.h seems to like "((unsigned long)1<<x)" for bitmaps
> >> >
> >> > along with a smattering of random noise all over of "(unsigned long)
> >> > n" where 'n' is some integer.
> >> >
> >> > Apparently people aren't as aware of the normal "ul" postfix syntax as
> >> > I would have expected. That said, it's a hundred-odd cases in all of
> >> > the kernel, so it's still fairly rare.
> >>
> >> Maybe this is something the kernel-janitors team should look at? (CC'd)
> >
> > Do you have some concrete examples of the code that is undesirable?
> 
> Joe Perches produced a patch for checkpatch to check for this [1]
> 
> Linus was complaining [2] about people producing constants with casts
> to basic C types in them. For instance:
> 
> #define IOMMU_ERROR_CODE (~(unsigned long) 0)
> 
> This could be replaced with
> 
> #define IOMMU_ERROR_CODE (~0ul)
> 
> or potentially
> 
> #define IOMMU_ERROR_CODE (-1ul)
> 
> It's not overly common, but it looks wrong.

Thanks.  The checkpatch solution indeed looks fine in this case.

julia

> Thanks,
> 
> Julian Calaby
> 
> [1] https://lkml.org/lkml/2015/11/6/48
> [2] https://lkml.org/lkml/2015/11/5/785
> 
> -- 
> Julian Calaby
> 
> Email: julian.calaby@gmail.com
> Profile: http://www.google.com/profiles/julian.calaby/
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT] Sparc David Miller <davem@davemloft.net> - 2015-11-05 22:50 +0100
  Re: [GIT] Sparc Linus Torvalds <torvalds@linux-foundation.org> - 2015-11-06 01:50 +0100
    Re: [GIT] Sparc Linus Torvalds <torvalds@linux-foundation.org> - 2015-11-06 02:00 +0100
      Re: [GIT] Sparc Julian Calaby <julian.calaby@gmail.com> - 2015-11-06 02:10 +0100
        Re: [GIT] Sparc Julia Lawall <julia.lawall@lip6.fr> - 2015-11-06 07:50 +0100
          Re: [GIT] Sparc Julian Calaby <julian.calaby@gmail.com> - 2015-11-07 04:40 +0100
            Re: [GIT] Sparc Julia Lawall <julia.lawall@lip6.fr> - 2015-11-07 07:10 +0100
      [PATCH] checkpatch: Warn when casting constants to c90 int or  longer types Joe Perches <joe@perches.com> - 2015-11-06 19:40 +0100
    Re: [GIT] Sparc David Miller <davem@davemloft.net> - 2015-11-06 06:20 +0100

csiph-web