* [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data
@ 2016-11-10 12:50 Shyam Sundar S K
2016-11-10 22:16 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Shyam Sundar S K @ 2016-11-10 12:50 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: linux-mmc, Sen, Pankaj, Agrawal, Nitesh-kumar,
Shah, Nehal-bakulchandra
Let devices define their own private data to facilitate device-specific
operations. The size of the private structure is specified in the
sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
space for it, and sdhci_pci_priv() can be used to get a reference to it.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci-core.c | 3 ++-
drivers/mmc/host/sdhci-pci.h | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 1d9e00a..782c8d2 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -1646,6 +1646,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
struct sdhci_pci_slot *slot;
struct sdhci_host *host;
int ret, bar = first_bar + slotno;
+ size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
@@ -1667,7 +1668,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
return ERR_PTR(-ENODEV);
}
- host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
+ host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
if (IS_ERR(host)) {
dev_err(&pdev->dev, "cannot allocate host\n");
return ERR_CAST(host);
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
index 6bccf56..0bfd568 100644
--- a/drivers/mmc/host/sdhci-pci.h
+++ b/drivers/mmc/host/sdhci-pci.h
@@ -67,6 +67,7 @@ struct sdhci_pci_fixes {
int (*resume) (struct sdhci_pci_chip *);
const struct sdhci_ops *ops;
+ size_t priv_size;
};
struct sdhci_pci_slot {
@@ -87,6 +88,7 @@ struct sdhci_pci_slot {
struct mmc_card *card,
unsigned int max_dtr, int host_drv,
int card_drv, int *drv_type);
+ unsigned long private[0] ____cacheline_aligned;
};
struct sdhci_pci_chip {
@@ -101,4 +103,9 @@ struct sdhci_pci_chip {
struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
};
+static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
+{
+ return (void *)slot->private;
+}
+
#endif /* __SDHCI_PCI_H */
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data
2016-11-10 12:50 [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data Shyam Sundar S K
@ 2016-11-10 22:16 ` Ulf Hansson
2016-11-11 4:12 ` Shyam Sundar S K
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2016-11-10 22:16 UTC (permalink / raw)
To: Shyam Sundar S K
Cc: Adrian Hunter, linux-mmc, Sen, Pankaj, Agrawal, Nitesh-kumar,
Shah, Nehal-bakulchandra
On 10 November 2016 at 13:50, Shyam Sundar S K <ssundark@amd.com> wrote:
> Let devices define their own private data to facilitate device-specific
> operations. The size of the private structure is specified in the
> sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
> space for it, and sdhci_pci_priv() can be used to get a reference to it.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Still not Adrian as author...
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-pci-core.c | 3 ++-
> drivers/mmc/host/sdhci-pci.h | 7 +++++++
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 1d9e00a..782c8d2 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -1646,6 +1646,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
> struct sdhci_pci_slot *slot;
> struct sdhci_host *host;
> int ret, bar = first_bar + slotno;
> + size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
>
> if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
> dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
> @@ -1667,7 +1668,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
> return ERR_PTR(-ENODEV);
> }
>
> - host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
> + host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
> if (IS_ERR(host)) {
> dev_err(&pdev->dev, "cannot allocate host\n");
> return ERR_CAST(host);
> diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
> index 6bccf56..0bfd568 100644
> --- a/drivers/mmc/host/sdhci-pci.h
> +++ b/drivers/mmc/host/sdhci-pci.h
> @@ -67,6 +67,7 @@ struct sdhci_pci_fixes {
> int (*resume) (struct sdhci_pci_chip *);
>
> const struct sdhci_ops *ops;
> + size_t priv_size;
> };
>
> struct sdhci_pci_slot {
> @@ -87,6 +88,7 @@ struct sdhci_pci_slot {
> struct mmc_card *card,
> unsigned int max_dtr, int host_drv,
> int card_drv, int *drv_type);
> + unsigned long private[0] ____cacheline_aligned;
> };
>
> struct sdhci_pci_chip {
> @@ -101,4 +103,9 @@ struct sdhci_pci_chip {
> struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
> };
>
> +static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
> +{
> + return (void *)slot->private;
> +}
> +
> #endif /* __SDHCI_PCI_H */
> --
> 2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data
2016-11-10 22:16 ` Ulf Hansson
@ 2016-11-11 4:12 ` Shyam Sundar S K
2016-11-11 7:00 ` Adrian Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Shyam Sundar S K @ 2016-11-11 4:12 UTC (permalink / raw)
To: Ulf Hansson
Cc: Adrian Hunter, linux-mmc, Sen, Pankaj, Agrawal, Nitesh-kumar,
Shah, Nehal-bakulchandra
On 11/11/2016 3:46 AM, Ulf Hansson wrote:
> On 10 November 2016 at 13:50, Shyam Sundar S K <ssundark@amd.com> wrote:
>> Let devices define their own private data to facilitate device-specific
>> operations. The size of the private structure is specified in the
>> sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
>> space for it, and sdhci_pci_priv() can be used to get a reference to it.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>
> Still not Adrian as author...
Hi Ulf,
It shows Adrian as author in my git log. I have done
git commit --amend --author="Adrian Hunter <adrian.hunter@intel.com>"
before generating the patch. Here is the git log output.
commit 169dce57501d234f436ba25e2a8c51aabc6792b5
Author: Adrian Hunter <adrian.hunter@intel.com>
Date: Thu Nov 10 17:52:51 2016 +0530
mmc: sdhci-pci: Let devices define their own private data
Let devices define their own private data to facilitate device-specific
operations. The size of the private structure is specified in the
sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
space for it, and sdhci_pci_priv() can be used to get a reference to it.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Thanks,
Shyam
>
> Kind regards
> Uffe
>
>> ---
>> drivers/mmc/host/sdhci-pci-core.c | 3 ++-
>> drivers/mmc/host/sdhci-pci.h | 7 +++++++
>> 2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
>> index 1d9e00a..782c8d2 100644
>> --- a/drivers/mmc/host/sdhci-pci-core.c
>> +++ b/drivers/mmc/host/sdhci-pci-core.c
>> @@ -1646,6 +1646,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
>> struct sdhci_pci_slot *slot;
>> struct sdhci_host *host;
>> int ret, bar = first_bar + slotno;
>> + size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
>>
>> if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
>> dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
>> @@ -1667,7 +1668,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
>> return ERR_PTR(-ENODEV);
>> }
>>
>> - host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
>> + host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
>> if (IS_ERR(host)) {
>> dev_err(&pdev->dev, "cannot allocate host\n");
>> return ERR_CAST(host);
>> diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
>> index 6bccf56..0bfd568 100644
>> --- a/drivers/mmc/host/sdhci-pci.h
>> +++ b/drivers/mmc/host/sdhci-pci.h
>> @@ -67,6 +67,7 @@ struct sdhci_pci_fixes {
>> int (*resume) (struct sdhci_pci_chip *);
>>
>> const struct sdhci_ops *ops;
>> + size_t priv_size;
>> };
>>
>> struct sdhci_pci_slot {
>> @@ -87,6 +88,7 @@ struct sdhci_pci_slot {
>> struct mmc_card *card,
>> unsigned int max_dtr, int host_drv,
>> int card_drv, int *drv_type);
>> + unsigned long private[0] ____cacheline_aligned;
>> };
>>
>> struct sdhci_pci_chip {
>> @@ -101,4 +103,9 @@ struct sdhci_pci_chip {
>> struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
>> };
>>
>> +static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
>> +{
>> + return (void *)slot->private;
>> +}
>> +
>> #endif /* __SDHCI_PCI_H */
>> --
>> 2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data
2016-11-11 4:12 ` Shyam Sundar S K
@ 2016-11-11 7:00 ` Adrian Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2016-11-11 7:00 UTC (permalink / raw)
To: Shyam Sundar S K, Ulf Hansson
Cc: linux-mmc, Sen, Pankaj, Agrawal, Nitesh-kumar,
Shah, Nehal-bakulchandra
On 11/11/16 06:12, Shyam Sundar S K wrote:
>
>
> On 11/11/2016 3:46 AM, Ulf Hansson wrote:
>> On 10 November 2016 at 13:50, Shyam Sundar S K <ssundark@amd.com> wrote:
>>> Let devices define their own private data to facilitate device-specific
>>> operations. The size of the private structure is specified in the
>>> sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
>>> space for it, and sdhci_pci_priv() can be used to get a reference to it.
>>>
>>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>>
>> Still not Adrian as author...
>
> Hi Ulf,
>
> It shows Adrian as author in my git log. I have done
>
> git commit --amend --author="Adrian Hunter <adrian.hunter@intel.com>"
>
> before generating the patch. Here is the git log output.
>
> commit 169dce57501d234f436ba25e2a8c51aabc6792b5
> Author: Adrian Hunter <adrian.hunter@intel.com>
> Date: Thu Nov 10 17:52:51 2016 +0530
>
> mmc: sdhci-pci: Let devices define their own private data
>
> Let devices define their own private data to facilitate device-specific
> operations. The size of the private structure is specified in the
> sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
> space for it, and sdhci_pci_priv() can be used to get a reference to it.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
"git am" takes the author from the "From" line of email messages. If that
is not the author, then you can add a "From" line in the message body. Read
'man git am' and please try sending patches to yourself, applying them, and
checking they are correct before sending again.
>
>
> Thanks,
> Shyam
>>
>> Kind regards
>> Uffe
>>
>>> ---
>>> drivers/mmc/host/sdhci-pci-core.c | 3 ++-
>>> drivers/mmc/host/sdhci-pci.h | 7 +++++++
>>> 2 files changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
>>> index 1d9e00a..782c8d2 100644
>>> --- a/drivers/mmc/host/sdhci-pci-core.c
>>> +++ b/drivers/mmc/host/sdhci-pci-core.c
>>> @@ -1646,6 +1646,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
>>> struct sdhci_pci_slot *slot;
>>> struct sdhci_host *host;
>>> int ret, bar = first_bar + slotno;
>>> + size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
>>>
>>> if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
>>> dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
>>> @@ -1667,7 +1668,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
>>> return ERR_PTR(-ENODEV);
>>> }
>>>
>>> - host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
>>> + host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
>>> if (IS_ERR(host)) {
>>> dev_err(&pdev->dev, "cannot allocate host\n");
>>> return ERR_CAST(host);
>>> diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
>>> index 6bccf56..0bfd568 100644
>>> --- a/drivers/mmc/host/sdhci-pci.h
>>> +++ b/drivers/mmc/host/sdhci-pci.h
>>> @@ -67,6 +67,7 @@ struct sdhci_pci_fixes {
>>> int (*resume) (struct sdhci_pci_chip *);
>>>
>>> const struct sdhci_ops *ops;
>>> + size_t priv_size;
>>> };
>>>
>>> struct sdhci_pci_slot {
>>> @@ -87,6 +88,7 @@ struct sdhci_pci_slot {
>>> struct mmc_card *card,
>>> unsigned int max_dtr, int host_drv,
>>> int card_drv, int *drv_type);
>>> + unsigned long private[0] ____cacheline_aligned;
>>> };
>>>
>>> struct sdhci_pci_chip {
>>> @@ -101,4 +103,9 @@ struct sdhci_pci_chip {
>>> struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
>>> };
>>>
>>> +static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
>>> +{
>>> + return (void *)slot->private;
>>> +}
>>> +
>>> #endif /* __SDHCI_PCI_H */
>>> --
>>> 2.7.4
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data
@ 2016-11-15 6:33 Shyam Sundar S K
0 siblings, 0 replies; 5+ messages in thread
From: Shyam Sundar S K @ 2016-11-15 6:33 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, linux-mmc, Sen, Pankaj,
Shah, Nehal-bakulchandra, Agrawal, Nitesh-kumar
From: Adrian Hunter <adrian.hunter@intel.com>
Let devices define their own private data to facilitate device-specific
operations. The size of the private structure is specified in the
sdhci_pci_fixes structure,then sdhci_pci_probe_slot() will allocate extra
space for it, and sdhci_pci_priv() can be used to get a reference to it.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
drivers/mmc/host/sdhci-pci-core.c | 3 ++-
drivers/mmc/host/sdhci-pci.h | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 1d9e00a..782c8d2 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -1646,6 +1646,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
struct sdhci_pci_slot *slot;
struct sdhci_host *host;
int ret, bar = first_bar + slotno;
+ size_t priv_size = chip->fixes ? chip->fixes->priv_size : 0;
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "BAR %d is not iomem. Aborting.\n", bar);
@@ -1667,7 +1668,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
return ERR_PTR(-ENODEV);
}
- host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
+ host = sdhci_alloc_host(&pdev->dev, sizeof(*slot) + priv_size);
if (IS_ERR(host)) {
dev_err(&pdev->dev, "cannot allocate host\n");
return ERR_CAST(host);
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
index 6bccf56..0bfd568 100644
--- a/drivers/mmc/host/sdhci-pci.h
+++ b/drivers/mmc/host/sdhci-pci.h
@@ -67,6 +67,7 @@ struct sdhci_pci_fixes {
int (*resume) (struct sdhci_pci_chip *);
const struct sdhci_ops *ops;
+ size_t priv_size;
};
struct sdhci_pci_slot {
@@ -87,6 +88,7 @@ struct sdhci_pci_slot {
struct mmc_card *card,
unsigned int max_dtr, int host_drv,
int card_drv, int *drv_type);
+ unsigned long private[0] ____cacheline_aligned;
};
struct sdhci_pci_chip {
@@ -101,4 +103,9 @@ struct sdhci_pci_chip {
struct sdhci_pci_slot *slots[MAX_SLOTS]; /* Pointers to host slots */
};
+static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
+{
+ return (void *)slot->private;
+}
+
#endif /* __SDHCI_PCI_H */
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-15 6:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10 12:50 [PATCH 1/2] mmc: sdhci-pci: Let devices define their own private data Shyam Sundar S K
2016-11-10 22:16 ` Ulf Hansson
2016-11-11 4:12 ` Shyam Sundar S K
2016-11-11 7:00 ` Adrian Hunter
-- strict thread matches above, loose matches on Subject: below --
2016-11-15 6:33 Shyam Sundar S K
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox