From: ygardi@codeaurora.org
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Yaniv Gardi <ygardi@codeaurora.org>,
merez@qti.qualcomm.com, dovl@qti.qualcomm.com,
Jej B <james.bottomley@hansenpartnership.com>,
LKML <linux-kernel@vger.kernel.org>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
linux-arm-msm@vger.kernel.org, Santosh Y <santoshsy@gmail.com>,
linux-scsi-owner@vger.kernel.org,
Subhash Jadavani <subhashj@codeaurora.org>,
Paul Bolle <pebolle@tiscali.nl>,
Gilad Broner <gbroner@codeaurora.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Vinayak Holikatti <vinholikatti@gmail.com>,
"James E.J. Bottomley" <jbottomley@odin.com>,
Dolev Raviv <draviv@codeaurora.org>,
Christoph Hellwig <hch@lst.de>,
Sujit Reddy Thumma <sthumma@codeaurora.org>,
Raviv Shvili
Subject: Re: [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device
Date: Sun, 7 Jun 2015 15:32:02 -0000 [thread overview]
Message-ID: <68c91f08f2be6c84055a303ca8aa3fe0.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <CAC5umyhWTLe_K+q9U=4M4N4Yu4Hp7hUxy4QiL=ch=JmYEiMBnQ@mail.gmail.com>
> 2015-06-05 5:53 GMT+09:00 <ygardi@codeaurora.org>:
>>> Hi Yaniv,
>>>
>>> 2015-06-03 18:37 GMT+09:00 Yaniv Gardi <ygardi@codeaurora.org>:
>>>> @@ -321,7 +313,22 @@ static int ufshcd_pltfrm_probe(struct
>>>> platform_device *pdev)
>>>> goto out;
>>>> }
>>>>
>>>> - hba->vops = get_variant_ops(&pdev->dev);
>>>> + err = of_platform_populate(node, NULL, NULL, &pdev->dev);
>>>> + if (err)
>>>> + dev_err(&pdev->dev,
>>>> + "%s: of_platform_populate() failed\n",
>>>> __func__);
>>>> +
>>>> + ufs_variant_node = of_get_next_available_child(node, NULL);
>>>> +
>>>> + if (!ufs_variant_node) {
>>>> + dev_dbg(&pdev->dev, "failed to find ufs_variant_node
>>>> child\n");
>>>> + } else {
>>>> + ufs_variant_pdev =
>>>> of_find_device_by_node(ufs_variant_node);
>>>> +
>>>> + if (ufs_variant_pdev)
>>>> + hba->vops = (struct ufs_hba_variant_ops *)
>>>> +
>>>> dev_get_drvdata(&ufs_variant_pdev->dev);
>>>> + }
>>>
>>> I have no strong objection to 'ufs_variant' sub-node. But why can't we
>>> simply add an of_device_id to ufs_of_match, like below:
>>>
>>> static const struct of_device_id ufs_of_match[] = {
>>> { .compatible = "jedec,ufs-1.1"},
>>> #if IS_ENABLED(SCSI_UFS_QCOM)
>>> { .compatible = "qcom,ufs", .data = &ufs_hba_qcom_vops },
>>> #neidf
>>> {},
>>> };
>>>
>>> and get hba->vops by get_variant_ops()?
>>>
>>
>> Hi Mita,
>> thanks for your comments.
>>
>> The whole idea, of having a sub-node which includes all variant specific
>> attributes is to separate the UFS Platform device component, from the
>> need
>> to know "qcom" or any other future variant.
>> I believe it keeps the code more modular, and clean - meaning - no
>> #ifdef's and no need to include all variant attributes inside the driver
>> DT node.
>> in that case, we simply have a DT node that is compatible to the Jdec
>> standard, and sub-node to include variant info.
>>
>> I hope you agree with this new design, since it provides a good answer
>> to every future variant that will be added, without the need to change
>> the
>> platform file.
>
> Thanks for your explanation, I agree with it.
>
> I found two problems in the current code, but both can be fixed
> relatively easily as described below:
>
> 1) If ufshcd-pltfrm driver is loaded before ufs-qcom driver,
> ufshcd_pltfrm_probe() can't find a ufs_variant device.
>
> In order to trigger re-probing ufs device when ufs-qcom driver has
> been loaded, ufshcd_pltfrm_probe() should return -EPROBE_DEFER in
> case 'ufs_variant' sub-node exists and no hba->vops found.
>
> 2) Nothing prevents ufs-qcom module from being unloaded while the
> variant_ops is referenced by ufshcd-pltfrm.
>
> It can be fixed by incrementing module refcount of ufs_variant module
> by __module_get(ufs_variant_pdev->dev.driver->owener) in
> ufshcd_pltfrm_probe(), and module_put() in ufshcd_pltfrm_remove()
> to descrement the refcount.
>
again, Mita, your comments are very appreciated.
1)
If ufshcd-pltfrm driver is loaded before ufs-qcom, (what actually happens
always), then the calling to of_platform_populate() which is added,
guarantees that ufs-qcom probe will be called and finish, before
ufshcd_pltfrm probe continues.
so ufs_variant device is always there, and ready.
I think it means we are safe - since either way, we make sure ufs-qcom
probe will be called and finish before dealing with ufs_variant device in
ufshcd_pltfrm probe.
2) you are right. the fix added as you suggested.
let us know your thoughts about the V3 once it's uploaded
thanks
next prev parent reply other threads:[~2015-06-07 15:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 9:37 [PATCH v2 0/4] fixing building errors and warnings when components Yaniv Gardi
2015-06-03 9:37 ` [PATCH v2 1/4] phy: qcom-ufs: fix build error when the component is built as a module Yaniv Gardi
2015-06-03 9:37 ` [PATCH v2 2/4] scsi: ufs-qcom: fix compilation warning if compiled " Yaniv Gardi
2015-06-03 9:37 ` [PATCH v2 3/4] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component Yaniv Gardi
2015-06-03 9:37 ` [PATCH v2 4/4] scsi: ufs: probe and init of variant driver from the platform device Yaniv Gardi
2015-06-04 14:07 ` Paul Bolle
2015-06-04 14:42 ` Paul Bolle
2015-06-04 20:42 ` ygardi
2015-06-07 15:22 ` ygardi-sgV2jX0FEOL9JmXXK+q4OQ
2015-06-04 14:32 ` Akinobu Mita
2015-06-04 20:53 ` ygardi
2015-06-05 16:47 ` Akinobu Mita
2015-06-07 15:32 ` ygardi [this message]
2015-06-08 14:47 ` Akinobu Mita
2015-06-08 15:02 ` Rob Herring
2015-06-09 5:53 ` Dov Levenglick
[not found] ` <bfade46f9d953e10240acb835105b81d.squirrel-mMfbam+mt9083fI46fginR2eb7JE58TQ@public.gmane.org>
2015-06-09 12:53 ` Rob Herring
2015-06-17 7:42 ` Dov Levenglick
2015-06-17 12:46 ` Rob Herring
2015-06-17 13:17 ` Dov Levenglick
2015-06-17 13:37 ` Rob Herring
2015-06-17 14:21 ` Dov Levenglick
2015-06-17 14:31 ` James Bottomley
2015-06-17 14:38 ` Dov Levenglick
[not found] ` <CAC5umyis6HU06KU-aSGoy6mCt-u+5Pz16nDk1qHrcsTnFo_2hA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-08 14:51 ` Rob Herring
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=68c91f08f2be6c84055a303ca8aa3fe0.squirrel@www.codeaurora.org \
--to=ygardi@codeaurora.org \
--cc=akinobu.mita@gmail.com \
--cc=dovl@qti.qualcomm.com \
--cc=draviv@codeaurora.org \
--cc=galak@codeaurora.org \
--cc=gbroner@codeaurora.org \
--cc=hch@lst.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=james.bottomley@hansenpartnership.com \
--cc=jbottomley@odin.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi-owner@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=merez@qti.qualcomm.com \
--cc=pawel.moll@arm.com \
--cc=pebolle@tiscali.nl \
--cc=robh+dt@kernel.org \
--cc=santoshsy@gmail.com \
--cc=sthumma@codeaurora.org \
--cc=subhashj@codeaurora.org \
--cc=vinholikatti@gmail.com \
/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).