Skip to contentSkip to conversation

ipmi: add pci remove handling

PATCH In review Corey Minyard 3 participants 5 messages Feb 14, 2007 – Feb 16, 2007 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 ipmi: add pci remove handling

Add pci_remove handling to the driver, so it will clean up if the device is hot-removed.

drivers/char/ipmi/ipmi_si_intf.c +3 -0
Index: linux-2.6.19/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
@@ -2191,12 +2191,15 @@ static int __devinit ipmi_pci_probe(stru
 		info->irq_setup = std_irq_setup;
 
 	info->dev = &pdev->dev;
+	pdev->dev->driver_data = info;
 
 	return try_smi_init(info);
 }
 
 static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
 {
+	struct smi_info *info = pdev->dev->driver_data;
+	cleanup_one_si(info);
 }
 
 #ifdef CONFIG_PM
#1 lore raw
Quoted 13 lines · On Wed, 14 Feb 2007 14:06:24 -0600 Corey Minyard <[email protected]> wrote:

Add pci_remove handling to the driver, so it will clean up if the device is hot-removed.

Index: linux-2.6.19/drivers/char/ipmi/ipmi_si_intf.c
===================================================================

drivers/char/ipmi/ipmi_si_intf.c +0 -0
@@ -2191,12 +2191,15 @@ static int __devinit ipmi_pci_probe(stru
 		info->irq_setup = std_irq_setup;
 
 	info->dev = &pdev->dev;

drivers/char/ipmi/ipmi_si_intf.c static int __devinit ipmi_pci_probe(stru · line 2203

Quoted 10 lines
drivers/char/ipmi/ipmi_si_intf.c +3 -0
+	pdev->dev->driver_data = info;
 
 	return try_smi_init(info);
 }
 
 static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
 {
+	struct smi_info *info = pdev->dev->driver_data;
+	cleanup_one_si(info);
 }

drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_pci_probe':
drivers/char/ipmi/ipmi_si_intf.c:2192: error: invalid type argument of '->' drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_pci_remove':
drivers/char/ipmi/ipmi_si_intf.c:2199: error: invalid type argument of '->'

Judging from the patch headers you were working against 2.6.19, which is most optimistic. Please always prepare and test patches against the latest kernel.

#2 lore raw
Quoted 4 lines · Andrew Morton

Judging from the patch headers you were working against 2.6.19, which is most optimistic. Please always prepare and test patches against the latest kernel.

Well, I had it applied against a 2.6.20 kernel, but I messed up the testing of it. Sorry, my bad.

New patch...

Add pci_remove handling to the driver, so it will clean up if the device is hot-removed.

drivers/char/ipmi/ipmi_si_intf.c +3 -0
Index: linux-2.6.20/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
@@ -2191,12 +2191,15 @@ static int __devinit ipmi_pci_probe(stru
 		info->irq_setup = std_irq_setup;
 
 	info->dev = &pdev->dev;
+	pdev->dev.driver_data = info;
 
 	return try_smi_init(info);
 }
 
 static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
 {
+	struct smi_info *info = pdev->dev.driver_data;
+	cleanup_one_si(info);
 }
 
 #ifdef CONFIG_PM
#3 lore raw

Am Donnerstag, 15. Februar 2007 schrieb Corey Minyard:

Quoted 24 lines · Andrew Morton
Quoted 3 lines

Judging from the patch headers you were working against 2.6.19, which is most optimistic. Please always prepare and test patches against the latest kernel.

Well, I had it applied against a 2.6.20 kernel, but I messed up the testing of it. Sorry, my bad.

New patch...

Add pci_remove handling to the driver, so it will clean up if the device is hot-removed.

Index: linux-2.6.20/drivers/char/ipmi/ipmi_si_intf.c
===================================================================

drivers/char/ipmi/ipmi_si_intf.c +0 -0
@@ -2191,12 +2191,15 @@ static int __devinit ipmi_pci_probe(stru
 		info->irq_setup = std_irq_setup;
 
 	info->dev = &pdev->dev;

drivers/char/ipmi/ipmi_si_intf.c static int __devinit ipmi_pci_probe(stru · line 2203

Quoted 10 lines
drivers/char/ipmi/ipmi_si_intf.c +3 -0
+	pdev->dev.driver_data = info;
 
 	return try_smi_init(info);
 }
 
 static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
 {
+	struct smi_info *info = pdev->dev.driver_data;
+	cleanup_one_si(info);
 }

Please use pci_{set,get}_drvdata() to access this field.

Greetings,

Eike

#4 lore raw
Quoted 6 lines · Rolf Eike Beer

Please use pci_{set,get}_drvdata() to access this field.

Greetings,

Eike

Yes, much better. Thanks. One more time...

Add pci_remove handling to the driver, so it will clean up if the device is hot-removed.

drivers/char/ipmi/ipmi_si_intf.c +3 -0
Index: linux-2.6.20/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
@@ -2191,12 +2191,15 @@ static int __devinit ipmi_pci_probe(stru
 		info->irq_setup = std_irq_setup;
 
 	info->dev = &pdev->dev;
+	pci_set_drvdata(pdev, info);
 
 	return try_smi_init(info);
 }
 
 static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
 {
+	struct smi_info *info = pci_get_drvdata(pdev);
+	cleanup_one_si(info);
 }
 
 #ifdef CONFIG_PM