public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: wei_wang@realsil.com.cn
Cc: gregkh@linuxfoundation.org, devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
	cjb@laptop.org, sameo@linux.intel.com, bp@alien8.de,
	aaron.lu@amd.com
Subject: Re: [PATCH 1/2] drivers/mfd: Add realtek pcie card reader driver
Date: Mon, 13 Aug 2012 13:06:21 +0000	[thread overview]
Message-ID: <201208131306.21248.arnd@arndb.de> (raw)
In-Reply-To: <1344823586-2956-1-git-send-email-wei_wang@realsil.com.cn>

On Monday 13 August 2012, wei_wang@realsil.com.cn wrote:
> From: Wei WANG <wei_wang@realsil.com.cn>
> 
> Realtek PCI-E card reader driver adapts requests from upper-level
> sdmmc/memstick layer to the real physical card reader.
> 
> Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>

Hi,

This looks pretty good overall, I'm generally happy with how you have
changed the structure. Looking at some of the details now:

> +
> +static const struct pcr_ops rts5209_pcr_ops = {
> +	.extra_init_hw = rts5209_extra_init_hw,
> +	.optimize_phy = rts5209_optimize_phy,
> +	.turn_on_led = rts5209_turn_on_led,
> +	.turn_off_led = rts5209_turn_off_led,
> +	.enable_auto_blink = rts5209_enable_auto_blink,
> +	.disable_auto_blink = rts5209_disable_auto_blink,
> +};
> ...
> +
> +static const struct pcr_ops rts5229_pcr_ops = {
> +	.extra_init_hw = rts5229_extra_init_hw,
> +	.optimize_phy = rts5229_optimize_phy,
> +	.turn_on_led = rts5229_turn_on_led,
> +	.turn_off_led = rts5229_turn_off_led,
> +	.enable_auto_blink = rts5229_enable_auto_blink,
> +	.disable_auto_blink = rts5229_disable_auto_blink,
> +};

Doing this separation is fine for two or three variants, especially
since the code behind them is not very big. If it becomes likely
that there will be many more variants, you should consider moving
them into separate files.

> +void rtsx_pci_start_run(struct rtsx_pcr *pcr)
> +{
> +	/* If pci device removed, don't queue idle work any more */
> +	if (pcr->remove_pci)
> +		return;
> +
> +	if (pcr->state != PDEV_STAT_RUN) {
> +		pcr->state = PDEV_STAT_RUN;
> +		pcr->ops->enable_auto_blink(pcr);
> +	}
> +
> +	cancel_delayed_work(&pcr->idle_work);
> +	queue_delayed_work(workqueue, &pcr->idle_work, msecs_to_jiffies(200));
> +}
> +EXPORT_SYMBOL_GPL(rtsx_pci_start_run);

Let me make sure I understand the logic here: When you send a command to
the driver, you turn on the blinking LED and then set a timer to turn
it off again after 200 ms, unless another command comes in, right?

This is slightly more overhead than I think you should have here.
Doing mod_timer() on a timer function might be better if you have a lot
of commands calling into rtsx_pci_start_run. Since you currently
require a mutex to be held when disabling the blinking, you might
need to schedule a work queue without timer from that timer function
though, or alternatively change the code to not require the mutex.

	Arnd

  parent reply	other threads:[~2012-08-13 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13  2:06 [PATCH 1/2] drivers/mfd: Add realtek pcie card reader driver wei_wang
2012-08-13  6:40 ` Dan Carpenter
2012-08-13  7:10   ` wwang
2012-08-13  7:13     ` Dan Carpenter
2012-08-13 13:06 ` Arnd Bergmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-14  5:30 wei_wang
2012-08-14  9:32 ` Arnd Bergmann
2012-08-14  9:46   ` wwang

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=201208131306.21248.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=aaron.lu@amd.com \
    --cc=bp@alien8.de \
    --cc=cjb@laptop.org \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --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