Skip to contentSkip to conversation

lx6464es: remove useles pci_set_drvdata(pdev, NULL)

PATCH In review Andy Shevchenko 2 participants 11 messages May 29, 2013 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lx6464es: remove useles pci_set_drvdata(pdev, NULL)

The driver core handles this.

---
 sound/pci/lx6464es/lx6464es.c | 1 -
 1 file changed, 1 deletion(-)
sound/pci/lx6464es/lx6464es.c +0 -1
index 298bc9b..3230e57 100644
@@ -1139,7 +1139,6 @@ out_free:
 static void snd_lx6464es_remove(struct pci_dev *pci)
 {
 	snd_card_free(pci_get_drvdata(pci));
-	pci_set_drvdata(pci, NULL);
 }
 
 
Signature · 1 line
1.8.2.rc0.22.gb3600c3
#1 lore raw

PATCH 2/3 lx6464es: dump MAC in standard form

Let's use %pM to print MAC wherever we need it.

---
 sound/pci/lx6464es/lx6464es.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/pci/lx6464es/lx6464es.c +2 -6
index 3230e57..33eb301 100644
@@ -798,9 +798,7 @@ static int lx_init_dsp(struct lx6464es *chip)
 
 mac_ready:
 	snd_printd(LXP "mac address ready read after: %dms\n", i);
-	snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
-		   chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		   chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	snd_printk(LXP "mac address: %pM\n", chip->mac_address);
 
 	err = lx_init_get_version_features(chip);
 	if (err)
@@ -1113,9 +1111,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	sprintf(card->id, "LX6464ES_%02X%02X%02X",
 		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
 
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);
 
 	sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i",
 		card->shortname, chip->port_plx,
Signature · 1 line
1.8.2.rc0.22.gb3600c3
#2 lore raw

Re: [PATCH 2/3] lx6464es: dump MAC in standard form

At Wed, 29 May 2013 13:03:21 +0300,

Quoted 24 lines · Andy Shevchenko

Let's use %pM to print MAC wherever we need it.

---
 sound/pci/lx6464es/lx6464es.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/pci/lx6464es/lx6464es.c +1 -3
index 3230e57..33eb301 100644
@@ -798,9 +798,7 @@ static int lx_init_dsp(struct lx6464es *chip)
 
 mac_ready:
 	snd_printd(LXP "mac address ready read after: %dms\n", i);
-	snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
-		   chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		   chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	snd_printk(LXP "mac address: %pM\n", chip->mac_address);
 
 	err = lx_init_get_version_features(chip);
 	if (err)

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1114

Quoted 7 lines
sound/pci/lx6464es/lx6464es.c +1 -3
@@ -1113,9 +1111,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	sprintf(card->id, "LX6464ES_%02X%02X%02X",
 		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
 
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);

This will change from the upper to the lower case, thus it'll lead to an incompatible name string, unfortunately.

Takashi

#3 lore raw

Re: [PATCH 2/3] lx6464es: dump MAC in standard form

Quoted 29 lines · Takashi Iwai

At Wed, 29 May 2013 13:03:21 +0300,

Quoted 27 lines · Andy Shevchenko

Let's use %pM to print MAC wherever we need it.

---
 sound/pci/lx6464es/lx6464es.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/pci/lx6464es/lx6464es.c +1 -3
index 3230e57..33eb301 100644
@@ -798,9 +798,7 @@ static int lx_init_dsp(struct lx6464es *chip)
 
 mac_ready:
 	snd_printd(LXP "mac address ready read after: %dms\n", i);
-	snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
-		   chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		   chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	snd_printk(LXP "mac address: %pM\n", chip->mac_address);
 
 	err = lx_init_get_version_features(chip);
 	if (err)
@@ -1113,9 +1111,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	sprintf(card->id, "LX6464ES_%02X%02X%02X",
 		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
 
Quoted 7 lines

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1114

Quoted 4 lines
sound/pci/lx6464es/lx6464es.c +1 -3
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);

This will change from the upper to the lower case, thus it'll lead to an incompatible name string, unfortunately.

Who is the user of this string?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#4 lore raw

Re: [PATCH 2/3] lx6464es: dump MAC in standard form

At Wed, 29 May 2013 14:00:57 +0300,

Quoted 39 lines · Andy Shevchenko
Quoted 29 lines · Takashi Iwai

At Wed, 29 May 2013 13:03:21 +0300,

Quoted 27 lines · Andy Shevchenko

Let's use %pM to print MAC wherever we need it.

---
 sound/pci/lx6464es/lx6464es.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
sound/pci/lx6464es/lx6464es.c +1 -3
index 3230e57..33eb301 100644
@@ -798,9 +798,7 @@ static int lx_init_dsp(struct lx6464es *chip)
 
 mac_ready:
 	snd_printd(LXP "mac address ready read after: %dms\n", i);
-	snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
-		   chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		   chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	snd_printk(LXP "mac address: %pM\n", chip->mac_address);
 
 	err = lx_init_get_version_features(chip);
 	if (err)
@@ -1113,9 +1111,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	sprintf(card->id, "LX6464ES_%02X%02X%02X",
 		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
 
Quoted 7 lines

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1114

Quoted 4 lines
sound/pci/lx6464es/lx6464es.c +1 -3
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);

This will change from the upper to the lower case, thus it'll lead to an incompatible name string, unfortunately.

Quoted 1 line

Who is the user of this string?

It's exposed to the user-space via ioctl and it can be used as an id string. So this will break user-space compatibility.

Takashi

#5 lore raw

Re: [PATCH 2/3] lx6464es: dump MAC in standard form

Quoted 8 lines · Takashi Iwai
Quoted 8 lines
Quoted 7 lines

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1114

Quoted 4 lines
sound/pci/lx6464es/lx6464es.c +1 -3
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);

This will change from the upper to the lower case, thus it'll lead to an incompatible name string, unfortunately.

Quoted 4 lines
Quoted 1 line

Who is the user of this string?

It's exposed to the user-space via ioctl and it can be used as an id string. So this will break user-space compatibility.

MAC is theoretically set of arbitrary 6 bytes.
Only what I can see here is the difference between '.' and ':' as a delimiter. But the MAC address form is defined in IEEE 802 standards.

Anyway, I am okay if you reject this one.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#6 lore raw

Re: [PATCH 2/3] lx6464es: dump MAC in standard form

At Wed, 29 May 2013 14:31:07 +0300,

Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · Takashi Iwai
Quoted 8 lines
Quoted 7 lines

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1114

Quoted 4 lines
sound/pci/lx6464es/lx6464es.c +1 -3
-	sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
-		chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);

This will change from the upper to the lower case, thus it'll lead to an incompatible name string, unfortunately.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Who is the user of this string?

It's exposed to the user-space via ioctl and it can be used as an id string. So this will break user-space compatibility.

MAC is theoretically set of arbitrary 6 bytes.
Only what I can see here is the difference between '.' and ':' as a delimiter. But the MAC address form is defined in IEEE 802 standards.

It doesn't matter whether it's a valid MAC representation or not. The problem is only that this patch will change the string representation, thus it becomes incompatible with older kernels. That's the only point.

Quoted 1 line

Anyway, I am okay if you reject this one.

Good :)

thanks,

Takashi

Quoted 4 lines
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#7 lore raw

PATCH 3/3 lx6464es: use %*phN to print small buffer in hex form

In reply to Andy Shevchenko
---
 sound/pci/lx6464es/lx6464es.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/lx6464es/lx6464es.c +1 -2
index 33eb301..7ad98f8 100644
@@ -1108,8 +1108,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	}
 
 	strcpy(card->driver, "LX6464ES");
-	sprintf(card->id, "LX6464ES_%02X%02X%02X",
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->id, "LX6464ES_%3phN", chip->mac_address + 3);
 
 	sprintf(card->shortname, "LX6464ES %pM", chip->mac_address);
 
Signature · 1 line
1.8.2.rc0.22.gb3600c3
#8 lore raw

Re: [PATCH 3/3] lx6464es: use %*phN to print small buffer in hex form

At Wed, 29 May 2013 13:03:22 +0300,

Quoted 11 lines · Andy Shevchenko
---
 sound/pci/lx6464es/lx6464es.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/lx6464es/lx6464es.c +0 -0
index 33eb301..7ad98f8 100644

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1111

Quoted 6 lines
sound/pci/lx6464es/lx6464es.c +1 -2
@@ -1108,8 +1108,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
 	}
 
 	strcpy(card->driver, "LX6464ES");
-	sprintf(card->id, "LX6464ES_%02X%02X%02X",
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->id, "LX6464ES_%3phN", chip->mac_address + 3);

The same problem as my previous comment. The case incompatible.

thanks,

Takashi

#9 lore raw

Re: [PATCH 3/3] lx6464es: use %*phN to print small buffer in hex form

Quoted 6 lines · Takashi Iwai

sound/pci/lx6464es/lx6464es.c static int snd_lx6464es_probe(struct pci_dev *pci, · line 1111

Quoted 4 lines
sound/pci/lx6464es/lx6464es.c +1 -2
 	strcpy(card->driver, "LX6464ES");
-	sprintf(card->id, "LX6464ES_%02X%02X%02X",
-		chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
+	sprintf(card->id, "LX6464ES_%3phN", chip->mac_address + 3);

The same problem as my previous comment. The case incompatible.

Here is card->id, which might be used by userspace in defined form. I rather agree with your objection here.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#10 lore raw
In reply to Andy Shevchenko

At Wed, 29 May 2013 13:03:20 +0300,

Quoted 4 lines · Andy Shevchenko

The driver core handles this.

Thanks, but I already queued a clean-up patch to remove the whole pci_set_drvdata() with NULL for all sound/* pci drivers.

Takashi

Quoted 19 lines
---
 sound/pci/lx6464es/lx6464es.c | 1 -
 1 file changed, 1 deletion(-)
sound/pci/lx6464es/lx6464es.c +0 -1
index 298bc9b..3230e57 100644
@@ -1139,7 +1139,6 @@ out_free:
 static void snd_lx6464es_remove(struct pci_dev *pci)
 {
 	snd_card_free(pci_get_drvdata(pci));
-	pci_set_drvdata(pci, NULL);
 }
 
 
Signature · 1 line
1.8.2.rc0.22.gb3600c3