linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call
@ 2016-02-17 11:58 Gabor Juhos
  2016-02-17 12:40 ` Alban
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gabor Juhos @ 2016-02-17 11:58 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-ide, Gabor Juhos, Alban Bedel, Ralf Baechle, Arnd Bergmann,
	stable

The RB532 platform specific irq_to_gpio() implementation has been
removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
custom gpio.h"). Now the platform uses the generic stub which causes
the following error:

  pata-rb532-cf pata-rb532-cf: no GPIO found for irq149
  pata-rb532-cf: probe of pata-rb532-cf failed with error -2

Drop the irq_to_gpio() call and get the GPIO number from platform
data instead. After this change, the driver works again:

  scsi host0: pata-rb532-cf
  ata1: PATA max PIO4 irq 149
  ata1.00: CFA: CF 1GB, 20080820, max MWDMA4
  ata1.00: 1989792 sectors, multi 0: LBA
  ata1.00: configured for PIO4
  scsi 0:0:0:0: Direct-Access     ATA      CF 1GB           0820 PQ: 0\
  ANSI: 5
  sd 0:0:0:0: [sda] 1989792 512-byte logical blocks: (1.01 GB/971 MiB)
  sd 0:0:0:0: [sda] Write Protect is off
  sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't\
  support DPO or FUA
   sda: sda1 sda2
  sd 0:0:0:0: [sda] Attached SCSI disk

Fixes: 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h")
Cc: Alban Bedel <albeu@free.fr>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/ata/pata_rb532_cf.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index 12fe0f3..c8b6a78 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -32,6 +32,8 @@
 #include <linux/libata.h>
 #include <scsi/scsi_host.h>
 
+#include <asm/mach-rc32434/rb.h>
+
 #define DRV_NAME	"pata-rb532-cf"
 #define DRV_VERSION	"0.1.0"
 #define DRV_DESC	"PATA driver for RouterBOARD 532 Compact Flash"
@@ -107,6 +109,7 @@ static int rb532_pata_driver_probe(struct platform_device *pdev)
 	int gpio;
 	struct resource *res;
 	struct ata_host *ah;
+	struct cf_device *pdata;
 	struct rb532_cf_info *info;
 	int ret;
 
@@ -122,7 +125,13 @@ static int rb532_pata_driver_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	gpio = irq_to_gpio(irq);
+	pdata = dev_get_platdata(&pdev->dev);
+	if (!pdata) {
+		dev_err(&pdev->dev, "no platform data specified\n");
+		return -EINVAL;
+	}
+
+	gpio = pdata->gpio_pin;
 	if (gpio < 0) {
 		dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq);
 		return -ENOENT;
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call
  2016-02-17 11:58 [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call Gabor Juhos
@ 2016-02-17 12:40 ` Alban
  2016-02-18 10:05   ` Gabor Juhos
  2016-02-18 16:28 ` Tejun Heo
  2016-02-18 16:46 ` Arnd Bergmann
  2 siblings, 1 reply; 5+ messages in thread
From: Alban @ 2016-02-17 12:40 UTC (permalink / raw)
  To: Gabor Juhos
  Cc: Aban Bedel, Tejun Heo, linux-ide, Ralf Baechle, Arnd Bergmann,
	stable

On Wed, 17 Feb 2016 12:58:20 +0100
Gabor Juhos <juhosg@openwrt.org> wrote:

> The RB532 platform specific irq_to_gpio() implementation has been
> removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
> custom gpio.h"). Now the platform uses the generic stub which causes
> the following error:
> 
>   pata-rb532-cf pata-rb532-cf: no GPIO found for irq149
>   pata-rb532-cf: probe of pata-rb532-cf failed with error -2
> 
> Drop the irq_to_gpio() call and get the GPIO number from platform
> data instead. After this change, the driver works again:

I think it would be preferable to move this driver to use the gpiod
API. The changes needed should be about the same size and it would
be a much more future proof fix.

Alban

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call
  2016-02-17 12:40 ` Alban
@ 2016-02-18 10:05   ` Gabor Juhos
  0 siblings, 0 replies; 5+ messages in thread
From: Gabor Juhos @ 2016-02-18 10:05 UTC (permalink / raw)
  To: Alban; +Cc: Tejun Heo, linux-ide, Ralf Baechle, Arnd Bergmann, stable

Hi Alban,

> On Wed, 17 Feb 2016 12:58:20 +0100
> Gabor Juhos <juhosg@openwrt.org> wrote:
> 
>> The RB532 platform specific irq_to_gpio() implementation has been
>> removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
>> custom gpio.h"). Now the platform uses the generic stub which causes
>> the following error:
>>
>>   pata-rb532-cf pata-rb532-cf: no GPIO found for irq149
>>   pata-rb532-cf: probe of pata-rb532-cf failed with error -2
>>
>> Drop the irq_to_gpio() call and get the GPIO number from platform
>> data instead. After this change, the driver works again:
> 
> I think it would be preferable to move this driver to use the gpiod
> API. The changes needed should be about the same size and it would
> be a much more future proof fix.

The sole purpose of this patch is that to fix the breakage introduced in
832f5dacfa0b. Before that change, the driver was working without using the gpiod
API, and it is working again after this change.

Converting the driver to use the gpiod API needs more changes. Even if that is
preferable it should be implemented in separate patch(es) in my opinion.

-Gabor

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call
  2016-02-17 11:58 [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call Gabor Juhos
  2016-02-17 12:40 ` Alban
@ 2016-02-18 16:28 ` Tejun Heo
  2016-02-18 16:46 ` Arnd Bergmann
  2 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2016-02-18 16:28 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: linux-ide, Alban Bedel, Ralf Baechle, Arnd Bergmann, stable

On Wed, Feb 17, 2016 at 12:58:20PM +0100, Gabor Juhos wrote:
> The RB532 platform specific irq_to_gpio() implementation has been
> removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
> custom gpio.h"). Now the platform uses the generic stub which causes
> the following error:

Applied to libata/for-4.5-fixes.  As for the gpiod API conversion,
please do that in separate patches.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call
  2016-02-17 11:58 [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call Gabor Juhos
  2016-02-17 12:40 ` Alban
  2016-02-18 16:28 ` Tejun Heo
@ 2016-02-18 16:46 ` Arnd Bergmann
  2 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2016-02-18 16:46 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: Tejun Heo, linux-ide, Alban Bedel, Ralf Baechle, stable

On Wednesday 17 February 2016 12:58:20 Gabor Juhos wrote:
> The RB532 platform specific irq_to_gpio() implementation has been
> removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
> custom gpio.h"). Now the platform uses the generic stub which causes
> the following error:
> 
>   pata-rb532-cf pata-rb532-cf: no GPIO found for irq149
>   pata-rb532-cf: probe of pata-rb532-cf failed with error -2
> 
> Drop the irq_to_gpio() call and get the GPIO number from platform
> data instead. After this change, the driver works again:
> 
>   scsi host0: pata-rb532-cf
>   ata1: PATA max PIO4 irq 149
>   ata1.00: CFA: CF 1GB, 20080820, max MWDMA4
>   ata1.00: 1989792 sectors, multi 0: LBA
>   ata1.00: configured for PIO4
>   scsi 0:0:0:0: Direct-Access     ATA      CF 1GB           0820 PQ: 0\
>   ANSI: 5
>   sd 0:0:0:0: [sda] 1989792 512-byte logical blocks: (1.01 GB/971 MiB)
>   sd 0:0:0:0: [sda] Write Protect is off
>   sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't\
>   support DPO or FUA
>    sda: sda1 sda2
>   sd 0:0:0:0: [sda] Attached SCSI disk
> 
> Fixes: 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h")
> Cc: Alban Bedel <albeu@free.fr>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

The patch looks good, but I now saw that drivers/pcmcia/db1xxx_ss.c
must have been broken by the same patch as this one, and it probably
needs a similar fix.

	Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-18 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 11:58 [PATCH] pata-rb532-cf: get rid of the irq_to_gpio() call Gabor Juhos
2016-02-17 12:40 ` Alban
2016-02-18 10:05   ` Gabor Juhos
2016-02-18 16:28 ` Tejun Heo
2016-02-18 16:46 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).