From: Lee Jones <lee.jones@linaro.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
Alex Dubov <oakad@yahoo.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
driverdev-devel@linuxdriverproject.org,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
wei_wang@realsil.com.cn, rogerable@realtek.com,
Chris Ball <cjb@laptop.org>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: Re: [PATCH 1/3] mfd: Add realtek USB card reader driver
Date: Tue, 14 Jan 2014 14:15:23 +0000 [thread overview]
Message-ID: <20140114141523.GC11820@lee--X1> (raw)
In-Reply-To: <20140114134634.GM7444@mwanda>
> [ Sorry, I am coming down with the flu today so I'm doing dorky things
> like reviewing review comments. I'm not sure how coherent I am. ]
Always welcome.
NB: I did this review in double-quick time, which may account for some
of the weird thought processes (or lack there of).
> > > +static void rtsx_usb_sg_timed_out(unsigned long data)
> > > +{
> > > + struct rtsx_ucr *ucr = (struct rtsx_ucr *)data;
> >
> > What's going to happen when your device runs 64bit?
> >
>
> I'm not sure I understand what you mean here. On linux sizeof(long) is
> always the same as sizeof(void *).
I had an odd moment where I thought we'd need long long for 64bit.
Nevermind.
> > > + if (cmd_len > IOBUF_SIZE)
> > > + return -EINVAL;
> > > +
> > > + if (cmd_len % 4)
> > > + cmd_len += (4 - cmd_len % 4);
> >
> > Please document in a comment.
>
> There is a kernel macro for this:
>
> cmd_len = ALIGN(cmd_len, 4);
>
> if (cmd_len > IOBUF_SIZE)
> return -EINVAL;
I had a feeling this was the intention, hence why I was asking for a
comment. But yes, if all this is doing is alignment then the kernel
macro is preferred.
> > > +
> > > +
> >
> > Extra '/n'
> >
>
> It weirds me out when you mix up '\n' and /n'.
Typos happen on occasion...
> > > +int rtsx_usb_ep0_write_register(struct rtsx_ucr *ucr, u16 addr,
> > > + u8 mask, u8 data)
> > > +{
> > > + u16 value = 0, index = 0;
> > > +
> > > + value |= 0x03 << 14;
> > > + value |= addr & 0x3FFF;
> > > + value = ((value << 8) & 0xFF00) | ((value >> 8) & 0x00FF);
> > > + index |= (u16)mask;
> > > + index |= (u16)data << 8;
> >
> > Lots of random numbers here, please #define for clarity and ease of
> > reading.
> >
>
> The only really random number is the 0x03, but yeah, it would help if
> that we a define.
See ---^
As I say, I just glossed over the code, thus didn't spend the time to
work out the arithmetic. Now I do, most of it is pretty self
explanatory. I would also like to see the SHIFT #defined, although
this may become superfluous once the 0x03 is clarified.
> addr |= 0x03 << 14;
>
> value = __swab16(addr);
> index = mask | (data << 8);
This is 100% better/clearer.
> > > +
> > > + dev_dbg(&intf->dev,
> > > + ": Realtek USB Card Reader found at bus %03d address %03d\n",
> > > + usb_dev->bus->busnum, usb_dev->devnum);
> > > +
> > > + ucr = kzalloc(sizeof(struct rtsx_ucr), GFP_KERNEL);
> >
> > s/struct rtsx_ucr/*ucr/
> >
> > Any reason for not using managed resources?
> >
> Roger, he means the devm_kzalloc().
That I do.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2014-01-14 14:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 7:47 [PATCH v2 0/3] Add modules for realtek USB card reader rogerable
2014-01-14 7:47 ` [PATCH 1/3] mfd: Add realtek USB card reader driver rogerable
2014-01-14 13:04 ` Lee Jones
2014-01-14 13:46 ` Dan Carpenter
2014-01-14 13:55 ` Dan Carpenter
2014-01-14 14:15 ` Lee Jones [this message]
2014-01-16 8:54 ` Roger
2014-01-16 9:35 ` Lee Jones
2014-01-20 8:55 ` Roger
2014-01-20 21:18 ` Greg Kroah-Hartman
2014-01-14 15:20 ` Greg Kroah-Hartman
2014-01-14 7:47 ` [PATCH 2/3] mmc: Add realtek USB sdmmc host driver rogerable
2014-01-14 7:47 ` [PATCH 3/3] memstick: Add realtek USB memstick " rogerable
2014-01-14 8:19 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2013-12-23 9:52 [PATCH 0/3] Add modules for realtek USB card reader rogerable
2013-12-23 9:52 ` [PATCH 1/3] mfd: Add realtek USB card reader driver rogerable
2014-01-02 9:47 ` Dan Carpenter
2014-01-08 7:56 ` Roger Tseng
2014-01-08 13:03 ` Dan Carpenter
2014-01-10 12:42 ` Oliver Neukum
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=20140114141523.GC11820@lee--X1 \
--to=lee.jones@linaro.org \
--cc=cjb@laptop.org \
--cc=dan.carpenter@oracle.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=oakad@yahoo.com \
--cc=rogerable@realtek.com \
--cc=sameo@linux.intel.com \
--cc=wei_wang@realsil.com.cn \
/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