mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ns16550: switch platform_data to drivers private data
Date: Fri, 5 Aug 2011 11:52:15 +0400	[thread overview]
Message-ID: <CAA4bVAF7+Ux=1T_su+=pNHFicgS=xgF92uRsnfwwx=rXQFwURw@mail.gmail.com> (raw)
In-Reply-To: <20110805063237.GA31404@pengutronix.de>

On 5 August 2011 10:32, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Fri, Aug 05, 2011 at 12:58:32AM +0400, Antony Pavlov wrote:
>> On 4 August 2011 23:37, Jean-Christophe PLAGNIOL-VILLARD
>> <plagnioj@jcrosoft.com> wrote:
>>
>> > --- a/drivers/serial/serial_ns16550.c
>> > +++ b/drivers/serial/serial_ns16550.c
>> > @@ -48,6 +48,55 @@
>> >
>> >  /*********** Private Functions **********************************/
>> >
>> > +/*
>> > + * We wrap our port structure around the generic console_device.
>> > + */
>> > +struct ns16550_uart_port {
>> > +       void __iomem *base;
>> > +       uint32_t shift;
>> > +       uint32_t clock;
>> > +       uint32_t (*read)(void __iomem *base, uint8_t off);
>> > +       void (*write)(uint32_t val, void __iomem *base, uint8_t off);
>> > +
>> > +       struct console_device uart;
>>
>>           nice trick :)))
>>
>>           But why the name is 'uart', not 'cdev'?
>> > +};
>>
>> As a rule, structure declarations go to header files.
>
> And as another rule, locally used struct (and also defines) go to the C
> file.
The file drivers/serial/serial_ns16550.h has so many defines of such type ...

>>
>> > +
>> > +static uint32_t ns16550_readb(void __iomem *base, uint8_t off)
>> > +{
>> > +       return readb(base + off);
>>
>>  warning: pointer of type ‘void *’ used in arithmetic
>
> Honestly, I can find nothing wrong in void * arithmetic. The
> alternatives like casting to/from unsigned long are much worse.

unsigned long is bad. We have discussed this two weeks ago.
See http://lists.infradead.org/pipermail/barebox/2011-July/003957.html

But void * is not created for arithmetic.
On the other hand we must choose the lesser of two evils.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-08-05  7:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03 16:36 [PATCH] serial_ns16550: drop the non working check Jean-Christophe PLAGNIOL-VILLARD
2011-08-04 19:37 ` [PATCH] ns16550: switch platform_data to drivers private data Jean-Christophe PLAGNIOL-VILLARD
2011-08-04 20:58   ` Antony Pavlov
2011-08-05  6:32     ` Sascha Hauer
2011-08-05  7:52       ` Antony Pavlov [this message]

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='CAA4bVAF7+Ux=1T_su+=pNHFicgS=xgF92uRsnfwwx=rXQFwURw@mail.gmail.com' \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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