Commit f1550f27 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Damien Le Moal

ata: sata_dwc_460ex: Use temporary variable for struct device

Use temporary variable for struct device to make code neater.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent f713961d
...@@ -215,9 +215,10 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) ...@@ -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 sata_dwc_device *hsdev = hsdevp->hsdev;
struct dw_dma_slave *dws = &sata_dwc_dma_dws; struct dw_dma_slave *dws = &sata_dwc_dma_dws;
struct device *dev = hsdev->dev;
dma_cap_mask_t mask; dma_cap_mask_t mask;
dws->dma_dev = hsdev->dev; dws->dma_dev = dev;
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, 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) ...@@ -225,8 +226,7 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp)
/* Acquire DMA channel */ /* Acquire DMA channel */
hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp); hsdevp->chan = dma_request_channel(mask, sata_dwc_dma_filter, hsdevp);
if (!hsdevp->chan) { if (!hsdevp->chan) {
dev_err(hsdev->dev, "%s: dma channel unavailable\n", dev_err(dev, "%s: dma channel unavailable\n", __func__);
__func__);
return -EAGAIN; return -EAGAIN;
} }
...@@ -236,19 +236,20 @@ static int sata_dwc_dma_get_channel_old(struct sata_dwc_device_port *hsdevp) ...@@ -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, static int sata_dwc_dma_init_old(struct platform_device *pdev,
struct sata_dwc_device *hsdev) 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) if (!hsdev->dma)
return -ENOMEM; return -ENOMEM;
hsdev->dma->dev = &pdev->dev; hsdev->dma->dev = dev;
hsdev->dma->id = pdev->id; hsdev->dma->id = pdev->id;
/* Get SATA DMA interrupt number */ /* Get SATA DMA interrupt number */
hsdev->dma->irq = irq_of_parse_and_map(np, 1); hsdev->dma->irq = irq_of_parse_and_map(np, 1);
if (hsdev->dma->irq == NO_IRQ) { 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; return -ENODEV;
} }
...@@ -1205,6 +1206,8 @@ static const struct ata_port_info sata_dwc_port_info[] = { ...@@ -1205,6 +1206,8 @@ static const struct ata_port_info sata_dwc_port_info[] = {
static int sata_dwc_probe(struct platform_device *ofdev) 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; struct sata_dwc_device *hsdev;
u32 idr, versionr; u32 idr, versionr;
char *ver = (char *)&versionr; char *ver = (char *)&versionr;
...@@ -1214,12 +1217,11 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1214,12 +1217,11 @@ static int sata_dwc_probe(struct platform_device *ofdev)
struct ata_host *host; struct ata_host *host;
struct ata_port_info pi = sata_dwc_port_info[0]; struct ata_port_info pi = sata_dwc_port_info[0];
const struct ata_port_info *ppi[] = { &pi, NULL }; const struct ata_port_info *ppi[] = { &pi, NULL };
struct device_node *np = ofdev->dev.of_node;
struct resource *res; struct resource *res;
/* Allocate DWC SATA device */ /* Allocate DWC SATA device */
host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_DWC_MAX_PORTS); host = ata_host_alloc_pinfo(dev, ppi, SATA_DWC_MAX_PORTS);
hsdev = devm_kzalloc(&ofdev->dev, sizeof(*hsdev), GFP_KERNEL); hsdev = devm_kzalloc(dev, sizeof(*hsdev), GFP_KERNEL);
if (!host || !hsdev) if (!host || !hsdev)
return -ENOMEM; return -ENOMEM;
...@@ -1229,7 +1231,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1229,7 +1231,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res); base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_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 */ /* Synopsys DWC SATA specific Registers */
hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET; hsdev->sata_dwc_regs = base + SATA_DWC_REG_OFFSET;
...@@ -1243,11 +1245,10 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1243,11 +1245,10 @@ static int sata_dwc_probe(struct platform_device *ofdev)
/* Read the ID and Version Registers */ /* Read the ID and Version Registers */
idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr); idr = sata_dwc_readl(&hsdev->sata_dwc_regs->idr);
versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr); versionr = sata_dwc_readl(&hsdev->sata_dwc_regs->versionr);
dev_notice(&ofdev->dev, "id %d, controller version %c.%c%c\n", dev_notice(dev, "id %d, controller version %c.%c%c\n", idr, ver[0], ver[1], ver[2]);
idr, ver[0], ver[1], ver[2]);
/* Save dev for later use in dev_xxx() routines */ /* Save dev for later use in dev_xxx() routines */
hsdev->dev = &ofdev->dev; hsdev->dev = dev;
/* Enable SATA Interrupts */ /* Enable SATA Interrupts */
sata_dwc_enable_interrupts(hsdev); sata_dwc_enable_interrupts(hsdev);
...@@ -1255,7 +1256,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1255,7 +1256,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
/* Get SATA interrupt number */ /* Get SATA interrupt number */
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
if (irq == NO_IRQ) { if (irq == NO_IRQ) {
dev_err(&ofdev->dev, "no SATA DMA irq\n"); dev_err(dev, "no SATA DMA irq\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1267,7 +1268,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1267,7 +1268,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
} }
#endif #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)) if (IS_ERR(hsdev->phy))
return PTR_ERR(hsdev->phy); return PTR_ERR(hsdev->phy);
...@@ -1282,7 +1283,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -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); err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht);
if (err) if (err)
dev_err(&ofdev->dev, "failed to activate host"); dev_err(dev, "failed to activate host");
return 0; return 0;
...@@ -1306,7 +1307,7 @@ static int sata_dwc_remove(struct platform_device *ofdev) ...@@ -1306,7 +1307,7 @@ static int sata_dwc_remove(struct platform_device *ofdev)
sata_dwc_dma_exit_old(hsdev); sata_dwc_dma_exit_old(hsdev);
#endif #endif
dev_dbg(&ofdev->dev, "done\n"); dev_dbg(dev, "done\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment