diff mbox series

scsi: aic94xx: fix module loading

Message ID 1548895332.2774.39.camel@HansenPartnership.com (mailing list archive)
State Mainlined
Commit 42caa0edabd6a0a392ec36a5f0943924e4954311
Headers show
Series scsi: aic94xx: fix module loading | expand

Commit Message

James Bottomley Jan. 31, 2019, 12:42 a.m. UTC
The aic94xx driver is currently failing to load with errors like

sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:02:00.3/0000:07:02.0/revision'

Because the PCI code had recently added a file named 'revision' to
every PCI device.  Fix this by renaming the aic94xx revision file to
aic_revision.  This is safe to do for us because as far as I can tell,
there's nothing in userspace relying on the current aic94xx revision
file so it can be renamed without breaking anything.

Fixes: 702ed3be1b1b (PCI: Create revision file in sysfs)
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

---

Patch is currently compile tested only ... I'm just excavating my
aic94xx based sas system from the unused equipment pile in the garage.

Comments

Emil Velikov Jan. 31, 2019, 10:29 a.m. UTC | #1
On Thu, 31 Jan 2019 at 00:42, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
>
> The aic94xx driver is currently failing to load with errors like
>
> sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:02:00.3/0000:07:02.0/revision'
>
> Because the PCI code had recently added a file named 'revision' to
> every PCI device.  Fix this by renaming the aic94xx revision file to
> aic_revision.  This is safe to do for us because as far as I can tell,
> there's nothing in userspace relying on the current aic94xx revision
> file so it can be renamed without breaking anything.
>
> Fixes: 702ed3be1b1b (PCI: Create revision file in sysfs)
> Cc: stable@vger.kernel.org
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

Thanks for sorting this out James
Emil
James Bottomley Feb. 1, 2019, 8:55 p.m. UTC | #2
On Wed, 2019-01-30 at 16:42 -0800, James Bottomley wrote:
> The aic94xx driver is currently failing to load with errors like
> 
> sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:02:00.3/0000:07:02.0/revision'
> 
> Because the PCI code had recently added a file named 'revision' to
> every PCI device.  Fix this by renaming the aic94xx revision file to
> aic_revision.  This is safe to do for us because as far as I can tell,
> there's nothing in userspace relying on the current aic94xx revision
> file so it can be renamed without breaking anything.
> 
> Fixes: 702ed3be1b1b (PCI: Create revision file in sysfs)
> Cc: stable@vger.kernel.org
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

I finally managed to test this on actual hardware and it works for me. 
I don't have any aic94xx cards, just a couple of IBM donated machines
that have aic94xx built in on an internal PCI express bus daughter
card, so I had to find them and persuade them to boot modern kernels
before I could actually test anything, hence the delay.

James
Martin K. Petersen Feb. 1, 2019, 11:05 p.m. UTC | #3
James,

> The aic94xx driver is currently failing to load with errors like
>
> sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:02:00.3/0000:07:02.0/revision'
>
> Because the PCI code had recently added a file named 'revision' to
> every PCI device.  Fix this by renaming the aic94xx revision file to
> aic_revision.  This is safe to do for us because as far as I can tell,
> there's nothing in userspace relying on the current aic94xx revision
> file so it can be renamed without breaking anything.

Applied to 5.0/scsi-fixes, thanks!
Hannes Reinecke Feb. 15, 2019, 7:09 a.m. UTC | #4
On 1/31/19 1:42 AM, James Bottomley wrote:
> The aic94xx driver is currently failing to load with errors like
> 
> sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/0000:02:00.3/0000:07:02.0/revision'
> 
> Because the PCI code had recently added a file named 'revision' to
> every PCI device.  Fix this by renaming the aic94xx revision file to
> aic_revision.  This is safe to do for us because as far as I can tell,
> there's nothing in userspace relying on the current aic94xx revision
> file so it can be renamed without breaking anything.
> 
> Fixes: 702ed3be1b1b (PCI: Create revision file in sysfs)
> Cc: stable@vger.kernel.org
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> 
> ---
> 
> Patch is currently compile tested only ... I'm just excavating my
> aic94xx based sas system from the unused equipment pile in the garage.
> 
> diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
> index 41c4d8abdd4a..38e768057129 100644
> --- a/drivers/scsi/aic94xx/aic94xx_init.c
> +++ b/drivers/scsi/aic94xx/aic94xx_init.c
> @@ -281,7 +281,7 @@ static ssize_t asd_show_dev_rev(struct device *dev,
>   	return snprintf(buf, PAGE_SIZE, "%s\n",
>   			asd_dev_rev[asd_ha->revision_id]);
>   }
> -static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL);
> +static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
>   
>   static ssize_t asd_show_dev_bios_build(struct device *dev,
>   				       struct device_attribute *attr,char *buf)
> @@ -478,7 +478,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
>   {
>   	int err;
>   
> -	err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
> +	err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
>   	if (err)
>   		return err;
>   
> @@ -500,13 +500,13 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
>   err_biosb:
>   	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
>   err_rev:
> -	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
> +	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
>   	return err;
>   }
>   
>   static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
>   {
> -	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
> +	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
>   	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
>   	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
>   	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);
> 
Raising the question why you create attributes under the PCI device at 
all. Typically these are created under the scsi_host sysfs device.
Why not here?

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 41c4d8abdd4a..38e768057129 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -281,7 +281,7 @@  static ssize_t asd_show_dev_rev(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "%s\n",
 			asd_dev_rev[asd_ha->revision_id]);
 }
-static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL);
+static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
 
 static ssize_t asd_show_dev_bios_build(struct device *dev,
 				       struct device_attribute *attr,char *buf)
@@ -478,7 +478,7 @@  static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
 {
 	int err;
 
-	err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
+	err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
 	if (err)
 		return err;
 
@@ -500,13 +500,13 @@  static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
 err_biosb:
 	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
 err_rev:
-	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
+	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
 	return err;
 }
 
 static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
 {
-	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
+	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
 	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
 	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
 	device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);