mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparc64: fix up bus_id changes in sparc core code
@ 2008-07-02 15:36 Greg Kroah-Hartman
  2008-07-03 10:35 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2008-07-02 15:36 UTC (permalink / raw)
  To: David S. Miller; +Cc: Kay Sievers, sparclinux, linux-kernel

From: Greg Kroah-Hartman <gregkh@suse.de>

This converts all instances of bus_id in the sparc core kernel to use
either dev_set_name(), or dev_name() depending on the need.

This is done in anticipation of removing the bus_id field from struct
driver.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/sparc64/kernel/ebus.c      |    4 ++--
 arch/sparc64/kernel/of_device.c |    4 ++--
 arch/sparc64/kernel/pci.c       |    2 +-
 arch/sparc64/kernel/vio.c       |   16 +++++++---------
 drivers/sbus/sbus.c             |    6 +++---
 5 files changed, 15 insertions(+), 17 deletions(-)

--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -401,7 +401,7 @@ static void __init fill_ebus_device(stru
 	dev->ofdev.node = dp;
 	dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
 	dev->ofdev.dev.bus = &ebus_bus_type;
-	sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
+	dev_set_name(&dev->ofdev.dev, "ebus[%08x]", dp->node);
 
 	/* Register with core */
 	if (of_device_register(&dev->ofdev) != 0)
@@ -501,7 +501,7 @@ void __init ebus_init(void)
 		ebus->ofdev.node = dp;
 		ebus->ofdev.dev.parent = &pdev->dev;
 		ebus->ofdev.dev.bus = &ebus_bus_type;
-		sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
+		dev_set_name(&ebus->ofdev.dev, "ebus%d", num_ebus);
 
 		/* Register with core */
 		if (of_device_register(&ebus->ofdev) != 0)
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -797,9 +797,9 @@ static struct of_device * __init scan_on
 	op->dev.parent = parent;
 	op->dev.bus = &of_platform_bus_type;
 	if (!parent)
-		strcpy(op->dev.bus_id, "root");
+		dev_set_name(&op->dev, "root");
 	else
-		sprintf(op->dev.bus_id, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->node);
 
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -408,7 +408,7 @@ struct pci_dev *of_create_pci_dev(struct
 	dev->class = class >> 8;
 	dev->revision = class & 0xff;
 
-	sprintf(dev->dev.bus_id, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
+	dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
 		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
 	if (ofpci_verbose)
--- a/arch/sparc64/kernel/vio.c
+++ b/arch/sparc64/kernel/vio.c
@@ -260,16 +260,14 @@ static struct vio_dev *vio_create_one(st
 	vio_fill_channel_info(hp, mp, vdev);
 
 	if (!id) {
-		snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s",
-			 bus_id_name);
+		dev_set_name(&vdev->dev, "%s", bus_id_name);
 		vdev->dev_no = ~(u64)0;
 	} else if (!cfg_handle) {
-		snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu",
-			 bus_id_name, *id);
+		dev_set_name(&vdev->dev, "%s-%lu", bus_id_name, *id);
 		vdev->dev_no = *id;
 	} else {
-		snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu-%lu",
-			 bus_id_name, *cfg_handle, *id);
+		dev_set_name(&vdev->dev, "%s-%lu-%lu", bus_id_name,
+			     *cfg_handle, *id);
 		vdev->dev_no = *cfg_handle;
 	}
 
@@ -292,12 +290,12 @@ static struct vio_dev *vio_create_one(st
 	}
 	vdev->dp = dp;
 
-	printk(KERN_INFO "VIO: Adding device %s\n", vdev->dev.bus_id);
+	printk(KERN_INFO "VIO: Adding device %s\n", dev_name(&vdev->dev));
 
 	err = device_register(&vdev->dev);
 	if (err) {
 		printk(KERN_ERR "VIO: Could not register device %s, err=%d\n",
-		       vdev->dev.bus_id, err);
+		       dev_name(&vdev->dev), err);
 		kfree(vdev);
 		return NULL;
 	}
@@ -330,7 +328,7 @@ static void vio_remove(struct mdesc_hand
 	dev = device_find_child(&root_vdev->dev, (void *) node,
 				vio_md_node_match);
 	if (dev) {
-		printk(KERN_INFO "VIO: Removing device %s\n", dev->bus_id);
+		printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev));
 
 		device_unregister(dev);
 	}
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -78,7 +78,7 @@ static void __init fill_sbus_device(stru
 	else
 		sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
 	sdev->ofdev.dev.bus = &sbus_bus_type;
-	sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node);
+	dev_set_name(&sdev->ofdev.dev, "sbus[%08x]", dp->node);
 
 	if (of_device_register(&sdev->ofdev) != 0)
 		printk(KERN_DEBUG "sbus: device registration error for %s!\n",
@@ -257,11 +257,11 @@ static void __init build_one_sbus(struct
 	sbus->ofdev.node = dp;
 	sbus->ofdev.dev.parent = NULL;
 	sbus->ofdev.dev.bus = &sbus_bus_type;
-	sprintf(sbus->ofdev.dev.bus_id, "sbus%d", num_sbus);
+	dev_set_name(&sbus->ofdev.dev, "sbus%d", num_sbus);
 
 	if (of_device_register(&sbus->ofdev) != 0)
 		printk(KERN_DEBUG "sbus: device registration error for %s!\n",
-		       sbus->ofdev.dev.bus_id);
+		       dev_name(&sbus->ofdev.dev));
 
 	dev_dp = dp->child;
 	while (dev_dp) {

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

* Re: [PATCH] sparc64: fix up bus_id changes in sparc core code
  2008-07-02 15:36 [PATCH] sparc64: fix up bus_id changes in sparc core code Greg Kroah-Hartman
@ 2008-07-03 10:35 ` David Miller
  2008-07-03 16:49   ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-07-03 10:35 UTC (permalink / raw)
  To: gregkh; +Cc: davem, kay.sievers, sparclinux, linux-kernel

From: Greg Kroah-Hartman <gregkh@suse.de>
Date: Wed, 2 Jul 2008 08:36:51 -0700

> --- a/arch/sparc64/kernel/pci.c
> +++ b/arch/sparc64/kernel/pci.c
> @@ -408,7 +408,7 @@ struct pci_dev *of_create_pci_dev(struct
>  	dev->class = class >> 8;
>  	dev->revision = class & 0xff;
>  
> -	sprintf(dev->dev.bus_id, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
> +	dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
>  		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
>  
>  	if (ofpci_verbose)

Those lines read:

	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));

in Linus's current tree.

What are you patching against?  That first argument is not
dev->dev.bus_id in any tree I have sitting here, it's always
pci_name() :-)

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

* Re: [PATCH] sparc64: fix up bus_id changes in sparc core code
  2008-07-03 10:35 ` David Miller
@ 2008-07-03 16:49   ` Greg KH
  2008-07-03 20:44     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2008-07-03 16:49 UTC (permalink / raw)
  To: David Miller, Jesse Barnes; +Cc: kay.sievers, sparclinux, linux-kernel

On Thu, Jul 03, 2008 at 03:35:56AM -0700, David Miller wrote:
> From: Greg Kroah-Hartman <gregkh@suse.de>
> Date: Wed, 2 Jul 2008 08:36:51 -0700
> 
> > --- a/arch/sparc64/kernel/pci.c
> > +++ b/arch/sparc64/kernel/pci.c
> > @@ -408,7 +408,7 @@ struct pci_dev *of_create_pci_dev(struct
> >  	dev->class = class >> 8;
> >  	dev->revision = class & 0xff;
> >  
> > -	sprintf(dev->dev.bus_id, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
> > +	dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
> >  		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
> >  
> >  	if (ofpci_verbose)
> 
> Those lines read:
> 
> 	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
> 		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
> 
> in Linus's current tree.
> 
> What are you patching against?  That first argument is not
> dev->dev.bus_id in any tree I have sitting here, it's always
> pci_name() :-)

Argh, I'm patching against a previous patch that was only sent to Jesse
for the PCI core, sorry for the confusion.

The patch for that is below.  It's probably easier for Jesse to take
both of these in his tree if you like, or I can send you just the Sparc
one, based on HEAD right now, and then the intermediate step in the PCI
patch would not be needed.

thanks,

greg k-h

From: Greg Kroah-Hartman <gregkh@suse.de>
Subject: PCI: make pci_name use dev_name

Also fixes up the sparc code that was assuming this is not a constant.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/sparc64/kernel/pci.c |    2 +-
 include/linux/pci.h       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -408,7 +408,7 @@ struct pci_dev *of_create_pci_dev(struct
 	dev->class = class >> 8;
 	dev->revision = class & 0xff;
 
-	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
+	sprintf(dev->dev.bus_id, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
 		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
 	if (ofpci_verbose)
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -977,9 +977,9 @@ static inline void pci_set_drvdata(struc
 /* If you want to know what to call your pci_dev, ask this function.
  * Again, it's a wrapper around the generic device.
  */
-static inline char *pci_name(struct pci_dev *pdev)
+static inline const char *pci_name(struct pci_dev *pdev)
 {
-	return pdev->dev.bus_id;
+	return dev_name(&pdev->dev);
 }
 
 

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

* Re: [PATCH] sparc64: fix up bus_id changes in sparc core code
  2008-07-03 16:49   ` Greg KH
@ 2008-07-03 20:44     ` David Miller
  2008-07-07 23:03       ` Jesse Barnes
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-07-03 20:44 UTC (permalink / raw)
  To: gregkh; +Cc: jbarnes, kay.sievers, sparclinux, linux-kernel

From: Greg KH <gregkh@suse.de>
Date: Thu, 3 Jul 2008 09:49:39 -0700

> Argh, I'm patching against a previous patch that was only sent to Jesse
> for the PCI core, sorry for the confusion.
> 
> The patch for that is below.  It's probably easier for Jesse to take
> both of these in his tree if you like, or I can send you just the Sparc
> one, based on HEAD right now, and then the intermediate step in the PCI
> patch would not be needed.
> 

It's easiest if Jesse takes them both, here is my ACK:

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH] sparc64: fix up bus_id changes in sparc core code
  2008-07-03 20:44     ` David Miller
@ 2008-07-07 23:03       ` Jesse Barnes
  0 siblings, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2008-07-07 23:03 UTC (permalink / raw)
  To: David Miller; +Cc: gregkh, kay.sievers, sparclinux, linux-kernel

On Thursday, July 03, 2008 1:44 pm David Miller wrote:
> From: Greg KH <gregkh@suse.de>
> Date: Thu, 3 Jul 2008 09:49:39 -0700
>
> > Argh, I'm patching against a previous patch that was only sent to Jesse
> > for the PCI core, sorry for the confusion.
> >
> > The patch for that is below.  It's probably easier for Jesse to take
> > both of these in his tree if you like, or I can send you just the Sparc
> > one, based on HEAD right now, and then the intermediate step in the PCI
> > patch would not be needed.
>
> It's easiest if Jesse takes them both, here is my ACK:
>
> Acked-by: David S. Miller <davem@davemloft.net>

Applied to my linux-next tree.  Thanks.

Jesse

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

end of thread, other threads:[~2008-07-07 23:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-02 15:36 [PATCH] sparc64: fix up bus_id changes in sparc core code Greg Kroah-Hartman
2008-07-03 10:35 ` David Miller
2008-07-03 16:49   ` Greg KH
2008-07-03 20:44     ` David Miller
2008-07-07 23:03       ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®