All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger <rogerable@realtek.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	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>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>
Subject: Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver
Date: Fri, 21 Mar 2014 14:43:25 +0800	[thread overview]
Message-ID: <532BDF8D.2060402@realtek.com> (raw)
In-Reply-To: <20140320161827.5904bc407f9d3490514fd84e@linux-foundation.org>

On 03/21/2014 07:18 AM, Andrew Morton wrote:
> On Wed, 12 Feb 2014 18:00:38 +0800 <rogerable@realtek.com> wrote:
>
>> From: Roger Tseng <rogerable@realtek.com>
>>
>> Realtek USB memstick host driver provides memstick host support based on the
>> Realtek USB card reader MFD driver.
>>
...
>> +static int rtsx_usb_ms_drv_probe(struct platform_device *pdev)
>> +{
>> +	struct memstick_host *msh;
>> +	struct rtsx_usb_ms *host;
>> +	struct rtsx_ucr *ucr;
>> +	int err;
>> +
>> +	ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent));
>> +	if (!ucr)
>> +		return -ENXIO;
>> +
>> +	dev_dbg(&(pdev->dev),
>> +			"Realtek USB Memstick controller found\n");
>> +
>> +	msh = memstick_alloc_host(sizeof(*host), &pdev->dev);
>> +	if (!msh)
>> +		return -ENOMEM;
>> +
>> +	host = memstick_priv(msh);
>> +	host->ucr = ucr;
>> +	host->msh = msh;
>> +	host->pdev = pdev;
>> +	host->power_mode = MEMSTICK_POWER_OFF;
>> +	platform_set_drvdata(pdev, host);
>> +
>> +	mutex_init(&host->host_mutex);
>> +	INIT_WORK(&host->handle_req, rtsx_usb_ms_handle_req);
>> +
>> +	init_completion(&host->detect_ms_exit);
>> +	host->detect_ms = kthread_create(rtsx_usb_detect_ms_card, host,
>> +			"rtsx_usb_ms_%d", pdev->id);
>> +	if (IS_ERR(host->detect_ms)) {
>> +		dev_dbg(&(pdev->dev),
>> +				"Unable to create polling thread.\n");
>> +		err = PTR_ERR(host->detect_ms);
>> +		goto err_out;
>> +	}
>> +
>> +	msh->request = rtsx_usb_ms_request;
>> +	msh->set_param = rtsx_usb_ms_set_param;
>> +	msh->caps = MEMSTICK_CAP_PAR4;
>> +
>> +	pm_runtime_enable(&pdev->dev);
>> +	err = memstick_add_host(msh);
>> +	if (err)
>> +		goto err_out;
>
> Isn't that kernel thread still running?
>
The kernel thread is created(kthread_create) but should not start before 
the "goto".

Did I miss anything or will it be better to move all kthread things 
after here?
>> +	wake_up_process(host->detect_ms);
>> +	return 0;
>> +err_out:
>> +	memstick_free_host(msh);
>> +	return err;
>> +}

Best regards,
Roger Tseng

WARNING: multiple messages have this Message-ID (diff)
From: Roger <rogerable@realtek.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>, Chris Ball <cjb@laptop.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Alex Dubov <oakad@yahoo.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	<linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
	<driverdev-devel@linuxdriverproject.org>,
	<wei_wang@realsil.com.cn>, <micky_ching@realsil.com.cn>
Subject: Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver
Date: Fri, 21 Mar 2014 14:43:25 +0800	[thread overview]
Message-ID: <532BDF8D.2060402@realtek.com> (raw)
In-Reply-To: <20140320161827.5904bc407f9d3490514fd84e@linux-foundation.org>

On 03/21/2014 07:18 AM, Andrew Morton wrote:
> On Wed, 12 Feb 2014 18:00:38 +0800 <rogerable@realtek.com> wrote:
>
>> From: Roger Tseng <rogerable@realtek.com>
>>
>> Realtek USB memstick host driver provides memstick host support based on the
>> Realtek USB card reader MFD driver.
>>
...
>> +static int rtsx_usb_ms_drv_probe(struct platform_device *pdev)
>> +{
>> +	struct memstick_host *msh;
>> +	struct rtsx_usb_ms *host;
>> +	struct rtsx_ucr *ucr;
>> +	int err;
>> +
>> +	ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent));
>> +	if (!ucr)
>> +		return -ENXIO;
>> +
>> +	dev_dbg(&(pdev->dev),
>> +			"Realtek USB Memstick controller found\n");
>> +
>> +	msh = memstick_alloc_host(sizeof(*host), &pdev->dev);
>> +	if (!msh)
>> +		return -ENOMEM;
>> +
>> +	host = memstick_priv(msh);
>> +	host->ucr = ucr;
>> +	host->msh = msh;
>> +	host->pdev = pdev;
>> +	host->power_mode = MEMSTICK_POWER_OFF;
>> +	platform_set_drvdata(pdev, host);
>> +
>> +	mutex_init(&host->host_mutex);
>> +	INIT_WORK(&host->handle_req, rtsx_usb_ms_handle_req);
>> +
>> +	init_completion(&host->detect_ms_exit);
>> +	host->detect_ms = kthread_create(rtsx_usb_detect_ms_card, host,
>> +			"rtsx_usb_ms_%d", pdev->id);
>> +	if (IS_ERR(host->detect_ms)) {
>> +		dev_dbg(&(pdev->dev),
>> +				"Unable to create polling thread.\n");
>> +		err = PTR_ERR(host->detect_ms);
>> +		goto err_out;
>> +	}
>> +
>> +	msh->request = rtsx_usb_ms_request;
>> +	msh->set_param = rtsx_usb_ms_set_param;
>> +	msh->caps = MEMSTICK_CAP_PAR4;
>> +
>> +	pm_runtime_enable(&pdev->dev);
>> +	err = memstick_add_host(msh);
>> +	if (err)
>> +		goto err_out;
>
> Isn't that kernel thread still running?
>
The kernel thread is created(kthread_create) but should not start before 
the "goto".

Did I miss anything or will it be better to move all kthread things 
after here?
>> +	wake_up_process(host->detect_ms);
>> +	return 0;
>> +err_out:
>> +	memstick_free_host(msh);
>> +	return err;
>> +}

Best regards,
Roger Tseng

  reply	other threads:[~2014-03-21  6:43 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 10:00 [PATCH v4 0/3] Add modules for realtek USB card reader rogerable
2014-02-12 10:00 ` rogerable
2014-02-12 10:00 ` [PATCH v4 1/3] mfd: Add realtek USB card reader driver rogerable
2014-02-12 10:00   ` rogerable
2014-02-14  9:44   ` Lee Jones
2014-02-17  6:09     ` Roger
2014-02-17  6:09       ` Roger
2014-02-17  8:22       ` Lee Jones
2014-02-17  9:16         ` Roger
2014-02-17  9:16           ` Roger
2014-02-17 10:02           ` Lee Jones
2014-02-17 10:24             ` Roger
2014-02-17 10:24               ` Roger
2014-02-17 12:03               ` Lee Jones
2014-02-17 12:03                 ` Lee Jones
2014-02-24  2:56                 ` Roger
2014-02-24  2:56                   ` Roger
2014-02-24  3:00                   ` Chris Ball
2014-02-24  3:00                     ` Chris Ball
2014-03-03  8:48                     ` Roger
2014-03-03  8:48                       ` Roger
2014-03-11  3:28                       ` Roger
2014-03-11  3:28                         ` Roger
2014-02-12 10:00 ` [PATCH v4 2/3] mmc: Add realtek USB sdmmc host driver rogerable
2014-02-12 10:00   ` rogerable
2014-02-12 10:24   ` Ulf Hansson
2014-02-12 10:24     ` Ulf Hansson
2014-02-12 10:00 ` [PATCH v4 3/3] memstick: Add realtek USB memstick " rogerable
2014-02-12 10:00   ` rogerable
2014-03-20  8:38   ` Roger
2014-03-20  8:38     ` Roger
2014-03-20 23:19     ` Andrew Morton
2014-03-20 23:19       ` Andrew Morton
2014-03-20 23:18   ` Andrew Morton
2014-03-20 23:18     ` Andrew Morton
2014-03-21  6:43     ` Roger [this message]
2014-03-21  6:43       ` Roger

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=532BDF8D.2060402@realtek.com \
    --to=rogerable@realtek.com \
    --cc=akpm@linux-foundation.org \
    --cc=cjb@laptop.org \
    --cc=dan.carpenter@oracle.com \
    --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=sameo@linux.intel.com \
    --cc=ulf.hansson@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.