Re: [PATCH 2/2] ata: pata_platform: Merge pata_of_platform into pata_platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
[...]
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



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux