lkml.org 
[lkml]   [2021]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] ata: pata_platform: Merge pata_of_platform into pata_platform
From
On 18.12.2021 13:51, Lad, Prabhakar wrote:

[...]
>>> Merge the OF pata_of_platform driver into pata_platform.
>>>
>>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[...]
>>> diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
>>> index cb3134bf88eb..b8d8d51bc562 100644
>>> --- a/drivers/ata/pata_platform.c
>>> +++ b/drivers/ata/pata_platform.c
[...]
>>> @@ -168,23 +180,83 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res,
>> [...]
>>>
>>> -static int pata_platform_probe(struct platform_device *pdev)
>>> +static int pata_of_platform_get_pdata(struct platform_device *ofdev,
>>> + struct pata_platform_priv *priv)
>>> {
>>> - struct resource *io_res;
>>> + struct device_node *dn = ofdev->dev.of_node;
>>> struct resource *ctl_res;
>>> struct resource *irq_res;
>>> + struct resource *io_res;
>>
>> Should be declared before ctl_res...
>>
> Any reason why?

Well, it's a natural order, following from the driver logic, no?

>>> + int pio_mode = 0;
>>> + int irq;
>>> + int ret;
>>> +
>>> + ctl_res = devm_kzalloc(&ofdev->dev, sizeof(*ctl_res), GFP_KERNEL);
>>> + io_res = devm_kzalloc(&ofdev->dev, sizeof(*io_res), GFP_KERNEL);
>>> + irq_res = devm_kzalloc(&ofdev->dev, sizeof(*irq_res), GFP_KERNEL);
>>> + if (!ctl_res || !io_res || !irq_res)
>>> + return -ENOMEM;
>>
>> Can't we get away from these allocated resources? Or at least irq_res?
>>
> Do you have any suggestions?

Let me look deeper...

[...]
>>> @@ -198,32 +270,63 @@ static int pata_platform_probe(struct platform_device *pdev)
[...]
>>> + if (ret)
>>> + return ret;
>>> +
>>> + priv->sht = &pata_platform_sht;
>>
>> Aren't those structures identical between the formerly separate drivers?
>>
> Yes so are you suggesting to drop sht from priv and use it directly?

Yep.

> Cheers,
> Prabhakar

MBR, Sergey

\
 
 \ /
  Last update: 2021-12-18 12:57    [W:0.046 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site