From: Dan Carpenter <dan.carpenter@oracle.com>
To: rogerable@realtek.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, Chris Ball <cjb@laptop.org>,
Lee Jones <lee.jones@linaro.org>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: Re: [PATCH 3/3] memstick: Add realtek USB memstick host driver
Date: Tue, 14 Jan 2014 11:19:53 +0300 [thread overview]
Message-ID: <20140114081953.GG7499@mwanda> (raw)
In-Reply-To: <1389685656-880-4-git-send-email-rogerable@realtek.com>
On Tue, Jan 14, 2014 at 03:47:36PM +0800, rogerable@realtek.com wrote:
> +static int ms_pull_ctl_disable(struct rtsx_ucr *ucr)
> +{
> + rtsx_usb_init_cmd(ucr);
> +
> + if (CHECK_PKG(ucr, LQFP48)) {
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL1, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL2, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL3, 0xFF, 0x95);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL4, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL5, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL6, 0xFF, 0xA5);
> + } else {
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL1, 0xFF, 0x65);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL2, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL3, 0xFF, 0x95);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL4, 0xFF, 0x55);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL5, 0xFF, 0x56);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD,
> + CARD_PULL_CTL6, 0xFF, 0x59);
> + }
> +
I'm fine with this patch going in as-is, but I just wanted to comment on
this for future reference/cleanups. These blocks where all the lines
are over 80 characters are hard to look at. We could break it into
separate functions.
static int ms_pull_ctl_disable_lqfp48(struct rtsx_ucr *ucr)
{
rtsx_usb_init_cmd(ucr);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL1, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL2, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL3, 0xFF, 0x95);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL4, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL5, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL6, 0xFF, 0xA5);
return rtsx_usb_send_cmd(ucr, MODE_C, 100);
}
Or another option would be to remove the "CARD_" prefix. I don't think
we would miss it.
if (CHECK_PKG(ucr, LQFP48)) {
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL1, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL2, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL3, 0xFF, 0x95);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL4, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL5, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL6, 0xFF, 0xA5);
} else {
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL1, 0xFF, 0x65);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL2, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL3, 0xFF, 0x95);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL4, 0xFF, 0x55);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL5, 0xFF, 0x56);
rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, PULL_CTL6, 0xFF, 0x59);
}
Another option might be to remove the "_usb" from the
rtsx_usb_add_cmd().
Just some ideas.
regards,
dan carpenter
next prev parent reply other threads:[~2014-01-14 8:19 UTC|newest]
Thread overview: 15+ 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
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 [this message]
-- 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 3/3] memstick: Add realtek USB memstick host driver rogerable
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=20140114081953.GG7499@mwanda \
--to=dan.carpenter@oracle.com \
--cc=cjb@laptop.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.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;
as well as URLs for NNTP newsgroup(s).