* [PATCH v1 1/3] ata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs @ 2021-12-09 14:35 Andy Shevchenko 2021-12-09 14:35 ` [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device Andy Shevchenko 2021-12-09 14:35 ` [PATCH v1 3/3] ata: sata_dwc_460ex: Remove unused forward declaration Andy Shevchenko 0 siblings, 2 replies; 7+ messages in thread From: Andy Shevchenko @ 2021-12-09 14:35 UTC (permalink / raw) To: Andy Shevchenko, linux-ide, linux-kernel; +Cc: Damien Le Moal Use devm_platform_get_and_ioremap_resource() and devm_platform_ioremap_resource() APIs instead of their open coded analogues. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/ata/sata_dwc_460ex.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 338c2e50f759..513bee589d12 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -237,7 +237,6 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev, struct sata_dwc_device *hsdev) { struct device_node *np = pdev->dev.of_node; - struct resource *res; hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL); if (!hsdev->dma) @@ -254,8 +253,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev, } /* Get physical SATA DMA register base address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - hsdev->dma->regs = devm_ioremap_resource(&pdev->dev, res); + hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(hsdev->dma->regs)) return PTR_ERR(hsdev->dma->regs); @@ -1228,8 +1226,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) host->private_data = hsdev; /* Ioremap SATA registers */ - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); - base = devm_ioremap_resource(&ofdev->dev, res); + base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res); if (IS_ERR(base)) return PTR_ERR(base); dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n"); -- 2.33.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device 2021-12-09 14:35 [PATCH v1 1/3] ata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs Andy Shevchenko @ 2021-12-09 14:35 ` Andy Shevchenko 2021-12-09 22:40 ` Damien Le Moal 2021-12-17 1:00 ` Damien Le Moal 2021-12-09 14:35 ` [PATCH v1 3/3] ata: sata_dwc_460ex: Remove unused forward declaration Andy Shevchenko 1 sibling, 2 replies; 7+ messages in thread From: Andy Shevchenko @ 2021-12-09 14:35 UTC (permalink / raw) To: Andy Shevchenko, linux-ide, linux-kernel; +Cc: Damien Le Moal Use temporary variable for struct device to make code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/ata/sata_dwc_460ex.c | 37 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 513bee589d12..5421f74c0199 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -215,9 +215,10 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) { struct sata_dwc_device *hsdev = hsdevp->hsdev; struct dw_dma_slave *dws = &sata_dwc_dma_dws; + struct device *dev = hsdev->dev; dma_cap_mask_t mask; - dws->dma_dev = hsdev->dev; + dws->dma_dev = dev; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); @@ -225,8 +226,7 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) /* Acquire DMA channel */ hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp); if (!hsdevp->chan) { - dev_err(hsdev->dev, "%s: dma channel unavailable\n", - __func__); + dev_err(dev, "%s: dma channel unavailable\n", __func__); return -EAGAIN; } @@ -236,19 +236,20 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) static int sata_dwc_dma_init_old(struct platform_device *pdev, struct sata_dwc_device *hsdev) { - struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; - hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL); + hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL); if (!hsdev->dma) return -ENOMEM; - hsdev->dma->dev = &pdev->dev; + hsdev->dma->dev = dev; hsdev->dma->id = pdev->id; /* Get SATA DMA interrupt number */ hsdev->dma->irq = irq_of_parse_and_map(np, 1); if (hsdev->dma->irq == NO_IRQ) { - dev_err(&pdev->dev, "no SATA DMA irq\n"); + dev_err(dev, "no SATA DMA irq\n"); return -ENODEV; } @@ -1205,6 +1206,8 @@ static const struct ata_port_info sata_dwc_port_info[] = { static int sata_dwc_probe(struct platform_device *ofdev) { + struct device *dev = &ofdev->dev; + struct device_node *np = dev->of_node; struct sata_dwc_device *hsdev; u32 idr, versionr; char *ver = (char *)&versionr; @@ -1214,12 +1217,11 @@ static int sata_dwc_probe(struct platform_device *ofdev) struct ata_host *host; struct ata_port_info pi = sata_dwc_port_info[0]; const struct ata_port_info *ppi[] = { &pi, NULL }; - struct device_node *np = ofdev->dev.of_node; struct resource *res; /* Allocate DWC SATA device */ - host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_DWC_MAX_PORTS); - hsdev = devm_kzalloc(&ofdev->dev, sizeof(*hsdev), GFP_KERNEL); + host = ata_host_alloc_pinfo(dev, ppi, SATA_DWC_MAX_PORTS); + hsdev = devm_kzalloc(dev, sizeof(*hsdev), GFP_KERNEL); if (!host || !hsdev) return -ENOMEM; @@ -1229,7 +1231,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res); if (IS_ERR(base)) return PTR_ERR(base); - dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n"); + dev_dbg(dev, "ioremap done for SATA register address\n"); /* Synopsys DWC SATA specific Registers */ hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET; @@ -1243,11 +1245,10 @@ static int sata_dwc_probe(struct platform_device *ofdev) /* Read the ID and Version Registers */ idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr); versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr); - dev_notice(&ofdev->dev, "id %d, controller version %c.%c%c\n", - idr, ver[0], ver[1], ver[2]); + dev_notice(dev, "id %d, controller version %c.%c%c\n", idr, ver[0], ver[1], ver[2]); /* Save dev for later use in dev_xxx() routines */ - hsdev->dev = &ofdev->dev; + hsdev->dev = dev; /* Enable SATA Interrupts */ sata_dwc_enable_interrupts(hsdev); @@ -1255,7 +1256,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) /* Get SATA interrupt number */ irq = irq_of_parse_and_map(np, 0); if (irq == NO_IRQ) { - dev_err(&ofdev->dev, "no SATA DMA irq\n"); + dev_err(dev, "no SATA DMA irq\n"); return -ENODEV; } @@ -1267,7 +1268,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) } #endif - hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); + hsdev->phy = devm_phy_optional_get(dev, "sata-phy"); if (IS_ERR(hsdev->phy)) return PTR_ERR(hsdev->phy); @@ -1282,7 +1283,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) */ err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); if (err) - dev_err(&ofdev->dev, "failed to activate host"); + dev_err(dev, "failed to activate host"); return 0; @@ -1306,7 +1307,7 @@ static int sata_dwc_remove(struct platform_device *ofdev) sata_dwc_dma_exit_old(hsdev); #endif - dev_dbg(&ofdev->dev, "done\n"); + dev_dbg(dev, "done\n"); return 0; } -- 2.33.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device 2021-12-09 14:35 ` [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device Andy Shevchenko @ 2021-12-09 22:40 ` Damien Le Moal 2021-12-10 8:42 ` Andy Shevchenko 2021-12-17 1:00 ` Damien Le Moal 1 sibling, 1 reply; 7+ messages in thread From: Damien Le Moal @ 2021-12-09 22:40 UTC (permalink / raw) To: Andy Shevchenko, linux-ide, linux-kernel On 2021/12/09 23:35, Andy Shevchenko wrote: > Use temporary variable for struct device to make code neater. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> What is this based on ? Is this on top of Hannes series ? > --- > drivers/ata/sata_dwc_460ex.c | 37 ++++++++++++++++++------------------ > 1 file changed, 19 insertions(+), 18 deletions(-) > > diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c > index 513bee589d12..5421f74c0199 100644 > --- a/drivers/ata/sata_dwc_460ex.c > +++ b/drivers/ata/sata_dwc_460ex.c > @@ -215,9 +215,10 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) > { > struct sata_dwc_device *hsdev = hsdevp->hsdev; > struct dw_dma_slave *dws = &sata_dwc_dma_dws; > + struct device *dev = hsdev->dev; > dma_cap_mask_t mask; > > - dws->dma_dev = hsdev->dev; > + dws->dma_dev = dev; > > dma_cap_zero(mask); > dma_cap_set(DMA_SLAVE, mask); > @@ -225,8 +226,7 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) > /* Acquire DMA channel */ > hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp); > if (!hsdevp->chan) { > - dev_err(hsdev->dev, "%s: dma channel unavailable\n", > - __func__); > + dev_err(dev, "%s: dma channel unavailable\n", __func__); > return -EAGAIN; > } > > @@ -236,19 +236,20 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) > static int sata_dwc_dma_init_old(struct platform_device *pdev, > struct sata_dwc_device *hsdev) > { > - struct device_node *np = pdev->dev.of_node; > + struct device *dev = &pdev->dev; > + struct device_node *np = dev->of_node; > > - hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL); > + hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL); > if (!hsdev->dma) > return -ENOMEM; > > - hsdev->dma->dev = &pdev->dev; > + hsdev->dma->dev = dev; > hsdev->dma->id = pdev->id; > > /* Get SATA DMA interrupt number */ > hsdev->dma->irq = irq_of_parse_and_map(np, 1); > if (hsdev->dma->irq == NO_IRQ) { > - dev_err(&pdev->dev, "no SATA DMA irq\n"); > + dev_err(dev, "no SATA DMA irq\n"); > return -ENODEV; > } > > @@ -1205,6 +1206,8 @@ static const struct ata_port_info sata_dwc_port_info[] = { > > static int sata_dwc_probe(struct platform_device *ofdev) > { > + struct device *dev = &ofdev->dev; > + struct device_node *np = dev->of_node; > struct sata_dwc_device *hsdev; > u32 idr, versionr; > char *ver = (char *)&versionr; > @@ -1214,12 +1217,11 @@ static int sata_dwc_probe(struct platform_device *ofdev) > struct ata_host *host; > struct ata_port_info pi = sata_dwc_port_info[0]; > const struct ata_port_info *ppi[] = { &pi, NULL }; > - struct device_node *np = ofdev->dev.of_node; > struct resource *res; > > /* Allocate DWC SATA device */ > - host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_DWC_MAX_PORTS); > - hsdev = devm_kzalloc(&ofdev->dev, sizeof(*hsdev), GFP_KERNEL); > + host = ata_host_alloc_pinfo(dev, ppi, SATA_DWC_MAX_PORTS); > + hsdev = devm_kzalloc(dev, sizeof(*hsdev), GFP_KERNEL); > if (!host || !hsdev) > return -ENOMEM; > > @@ -1229,7 +1231,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) > base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res); > if (IS_ERR(base)) > return PTR_ERR(base); > - dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n"); > + dev_dbg(dev, "ioremap done for SATA register address\n"); > > /* Synopsys DWC SATA specific Registers */ > hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET; > @@ -1243,11 +1245,10 @@ static int sata_dwc_probe(struct platform_device *ofdev) > /* Read the ID and Version Registers */ > idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr); > versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr); > - dev_notice(&ofdev->dev, "id %d, controller version %c.%c%c\n", > - idr, ver[0], ver[1], ver[2]); > + dev_notice(dev, "id %d, controller version %c.%c%c\n", idr, ver[0], ver[1], ver[2]); > > /* Save dev for later use in dev_xxx() routines */ > - hsdev->dev = &ofdev->dev; > + hsdev->dev = dev; > > /* Enable SATA Interrupts */ > sata_dwc_enable_interrupts(hsdev); > @@ -1255,7 +1256,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) > /* Get SATA interrupt number */ > irq = irq_of_parse_and_map(np, 0); > if (irq == NO_IRQ) { > - dev_err(&ofdev->dev, "no SATA DMA irq\n"); > + dev_err(dev, "no SATA DMA irq\n"); > return -ENODEV; > } > > @@ -1267,7 +1268,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) > } > #endif > > - hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); > + hsdev->phy = devm_phy_optional_get(dev, "sata-phy"); > if (IS_ERR(hsdev->phy)) > return PTR_ERR(hsdev->phy); > > @@ -1282,7 +1283,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) > */ > err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht); > if (err) > - dev_err(&ofdev->dev, "failed to activate host"); > + dev_err(dev, "failed to activate host"); > > return 0; > > @@ -1306,7 +1307,7 @@ static int sata_dwc_remove(struct platform_device *ofdev) > sata_dwc_dma_exit_old(hsdev); > #endif > > - dev_dbg(&ofdev->dev, "done\n"); > + dev_dbg(dev, "done\n"); > return 0; > } > -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device 2021-12-09 22:40 ` Damien Le Moal @ 2021-12-10 8:42 ` Andy Shevchenko 2021-12-10 9:25 ` Hannes Reinecke 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2021-12-10 8:42 UTC (permalink / raw) To: Damien Le Moal, Hannes Reinecke Cc: Andy Shevchenko, linux-ide, Linux Kernel Mailing List On Fri, Dec 10, 2021 at 4:25 AM Damien Le Moal <damien.lemoal@opensource.wdc.com> wrote: > > On 2021/12/09 23:35, Andy Shevchenko wrote: > > Use temporary variable for struct device to make code neater. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > What is this based on ? Is this on top of Hannes series ? Nope, on latest (available) Linux Next. Hannes, can you incorporate this to yours maybe? I see one conflict with the last patch. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device 2021-12-10 8:42 ` Andy Shevchenko @ 2021-12-10 9:25 ` Hannes Reinecke 0 siblings, 0 replies; 7+ messages in thread From: Hannes Reinecke @ 2021-12-10 9:25 UTC (permalink / raw) To: Andy Shevchenko, Damien Le Moal Cc: Andy Shevchenko, linux-ide, Linux Kernel Mailing List On 12/10/21 9:42 AM, Andy Shevchenko wrote: > On Fri, Dec 10, 2021 at 4:25 AM Damien Le Moal > <damien.lemoal@opensource.wdc.com> wrote: >> >> On 2021/12/09 23:35, Andy Shevchenko wrote: >>> Use temporary variable for struct device to make code neater. >>> >>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> >> >> What is this based on ? Is this on top of Hannes series ? > > Nope, on latest (available) Linux Next. > Hannes, can you incorporate this to yours maybe? I see one conflict > with the last patch. > Sure. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device 2021-12-09 14:35 ` [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device Andy Shevchenko 2021-12-09 22:40 ` Damien Le Moal @ 2021-12-17 1:00 ` Damien Le Moal 1 sibling, 0 replies; 7+ messages in thread From: Damien Le Moal @ 2021-12-17 1:00 UTC (permalink / raw) To: Andy Shevchenko, linux-ide, linux-kernel, Hannes Reinecke On 12/9/21 23:35, Andy Shevchenko wrote: > Use temporary variable for struct device to make code neater. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Applied all 3 patche to for-5.17. Hannes, Please rebase your v3 series on that branch. (if possible, I would like to get it soon, pleasse !) -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 3/3] ata: sata_dwc_460ex: Remove unused forward declaration 2021-12-09 14:35 [PATCH v1 1/3] ata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs Andy Shevchenko 2021-12-09 14:35 ` [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device Andy Shevchenko @ 2021-12-09 14:35 ` Andy Shevchenko 1 sibling, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2021-12-09 14:35 UTC (permalink / raw) To: Andy Shevchenko, linux-ide, linux-kernel; +Cc: Damien Le Moal sata_dwc_port_stop() is not used before being defined, remove redundant forward declaration. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/ata/sata_dwc_460ex.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 5421f74c0199..bd4859563796 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -185,7 +185,6 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag); static int sata_dwc_qc_complete(struct ata_port *ap, struct ata_queued_cmd *qc, u32 check_status); static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status); -static void sata_dwc_port_stop(struct ata_port *ap); static void sata_dwc_clear_dmacr(struct sata_dwc_device_port *hsdevp, u8 tag); #ifdef CONFIG_SATA_DWC_OLD_DMA -- 2.33.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-17 1:00 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-09 14:35 [PATCH v1 1/3] ata: sata_dwc_460ex: Use devm_platform_*ioremap_resource() APIs Andy Shevchenko 2021-12-09 14:35 ` [PATCH v1 2/3] ata: sata_dwc_460ex: Use temporary variable for struct device Andy Shevchenko 2021-12-09 22:40 ` Damien Le Moal 2021-12-10 8:42 ` Andy Shevchenko 2021-12-10 9:25 ` Hannes Reinecke 2021-12-17 1:00 ` Damien Le Moal 2021-12-09 14:35 ` [PATCH v1 3/3] ata: sata_dwc_460ex: Remove unused forward declaration Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox