From e94b1766097d53e6f3ccfb36c8baa562ffeda3fc Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 6 Dec 2006 20:33:17 -0800 Subject: [PATCH] slab: remove SLAB_KERNEL SLAB_KERNEL is an alias of GFP_KERNEL. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/ieee1394/ohci1394.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 6e8ea9110c4..eae97d8dcf0 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -1225,7 +1225,7 @@ static int ohci_iso_recv_init(struct hpsb_iso *iso) int ctx; int ret = -ENOMEM; - recv = kmalloc(sizeof(*recv), SLAB_KERNEL); + recv = kmalloc(sizeof(*recv), GFP_KERNEL); if (!recv) return -ENOMEM; @@ -1918,7 +1918,7 @@ static int ohci_iso_xmit_init(struct hpsb_iso *iso) int ctx; int ret = -ENOMEM; - xmit = kmalloc(sizeof(*xmit), SLAB_KERNEL); + xmit = kmalloc(sizeof(*xmit), GFP_KERNEL); if (!xmit) return -ENOMEM; @@ -3021,7 +3021,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d, return -ENOMEM; } - d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); + d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); OHCI_DMA_ALLOC("pool dma_rcv prg[%d]", i); if (d->prg_cpu[i] != NULL) { @@ -3117,7 +3117,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, OHCI_DMA_ALLOC("dma_rcv prg pool"); for (i = 0; i < d->num_desc; i++) { - d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, SLAB_KERNEL, d->prg_bus+i); + d->prg_cpu[i] = pci_pool_alloc(d->prg_pool, GFP_KERNEL, d->prg_bus+i); OHCI_DMA_ALLOC("pool dma_trm prg[%d]", i); if (d->prg_cpu[i] != NULL) { -- cgit v1.2.3-70-g09d2 From f011bf085cd41ee40c2c8e530f801ac6cb6e00d0 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Wed, 6 Sep 2006 14:58:30 +0200 Subject: ohci1394: steps to implement suspend/resume I did a quick shot on what I described and the appended patch does the first thing needed for working suspend/resume in ohci1394 which is HW de- and re-initialisation. It works with suspend2disk on my Ricoh R5C552 IEEE 1394 Controller with the 2.6.17 kernel to the extent that if I call dvgrab --interactive after suspend2disk without unloading ohci1394, it does not lock up dvgrab with 100% CPU but properly connects to the camera, given that I first unplug and plug the camera after coming back from suspend. I guess that could be fixed by forcing a bus reset in the resume function. I cannot test suspend to RAM here at the moment and should follow the guidelines in Documentation/power/pci.txt also, so this is rather a quick report than a finished patch and there are some rough edges: However, with this patch, I have to unload at least some in-kernel users of ohci1394 like dv1394 or video1394 before suspending. Not doing that caused an Oops and a bad tasklet error, probably from not handling ISO tasklets during suspend/resume properly. Maybe these can be temporarily cleared or unregistered and re-registered for suspend/resume with help from the other layers or from the highlevel 1394 core, but I do not really know what these do. But this patch provides a useful base to start from and is already of much help for people which do not need dv1394 and video1394 or can unload them at least during suspend. I cannot test function with sbp2 at the moment, but raw1394 seems to work fine. Signed-off-by: Bernhard Kaindl Update 1: merge with previous two ohci1394 suspend/resume patches Update 2: version for application on top of Linux 2.6.19-rc4 Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 92 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 14 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index eae97d8dcf0..b98b9934b92 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3531,6 +3531,9 @@ static void ohci1394_pci_remove(struct pci_dev *pdev) #ifdef CONFIG_PM static int ohci1394_pci_resume (struct pci_dev *pdev) { + int err; + struct ti_ohci *ohci; + /* PowerMac resume code comes first */ #ifdef CONFIG_PPC_PMAC if (machine_is(powermac)) { @@ -3545,28 +3548,89 @@ static int ohci1394_pci_resume (struct pci_dev *pdev) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); - return pci_enable_device(pdev); + err = pci_enable_device(pdev); + if (err) + return err; + + ohci = pci_get_drvdata(pdev); + if (!ohci) + return -1; /* or which exit status to use? */ + + PRINT(KERN_DEBUG, "resume called"); + + /* The following lines are copied from ohci1394_pci_probe(): */ + + /* Start off with a soft reset, to clear everything to a sane + * state. */ + ohci_soft_reset(ohci); + + /* Now enable LPS, which we need in order to start accessing + * most of the registers. In fact, on some cards (ALI M5251), + * accessing registers in the SClk domain without LPS enabled + * will lock up the machine. Wait 50msec to make sure we have + * full link enabled. */ + reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); + + /* Disable and clear interrupts */ + reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); + reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); + + mdelay(50); + + ohci_initialize(ohci); + + return 0; } static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state) { int err; + struct ti_ohci *ohci; + + ohci = pci_get_drvdata(pdev); + if (!ohci) + return -1; /* Not sure if this is the correct return code */ + + PRINT(KERN_DEBUG, "suspend called"); + + /* clear the async DMA contexts and stop using the controller: */ + hpsb_bus_reset(ohci->host); + + /* The following calls are from ohci1394_pci_remove(): */ - printk(KERN_INFO "%s does not fully support suspend and resume yet\n", - OHCI1394_DRIVER_NAME); + /* Clear out BUS Options */ + reg_write(ohci, OHCI1394_ConfigROMhdr, 0); + reg_write(ohci, OHCI1394_BusOptions, + (reg_read(ohci, OHCI1394_BusOptions) & 0x0000f007) | + 0x00ff0000); + + /* Clear interrupt registers */ + reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); + reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); + reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff); + reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff); + reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff); + reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff); + + /* Disable IRM Contender */ + set_phy_reg(ohci, 4, ~0xc0 & get_phy_reg(ohci, 4)); + + /* Clear link control register */ + reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff); + + /* Let all other nodes know to ignore us */ + ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); + + /* This stops all DMA contexts, disables interrupts, + * and clears linkEnable and LPS: */ + ohci_soft_reset(ohci); err = pci_save_state(pdev); - if (err) { - printk(KERN_ERR "%s: pci_save_state failed with %d\n", - OHCI1394_DRIVER_NAME, err); - return err; - } + if (err) + goto out; err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); -#ifdef OHCI1394_DEBUG if (err) - printk(KERN_DEBUG "%s: pci_set_power_state failed with %d\n", - OHCI1394_DRIVER_NAME, err); -#endif /* OHCI1394_DEBUG */ + goto out; /* PowerMac suspend code comes last */ #ifdef CONFIG_PPC_PMAC @@ -3579,8 +3643,8 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state) pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); } #endif /* CONFIG_PPC_PMAC */ - - return 0; +out: + return err; } #endif /* CONFIG_PM */ -- cgit v1.2.3-70-g09d2 From da256c55373cbc45e30f868e0bddb81ddc4067bf Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sun, 24 Sep 2006 11:01:00 +0200 Subject: ieee1394: ohci1394: suspend/resume cosmetics Reorder the definitions of ohci1394_pci_suspend and _resume. Remove redundant comments. Beautify return statements. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 126 +++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 78 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index b98b9934b92..a12802553b4 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3529,108 +3529,40 @@ static void ohci1394_pci_remove(struct pci_dev *pdev) } #ifdef CONFIG_PM -static int ohci1394_pci_resume (struct pci_dev *pdev) +static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) { int err; - struct ti_ohci *ohci; - -/* PowerMac resume code comes first */ -#ifdef CONFIG_PPC_PMAC - if (machine_is(powermac)) { - struct device_node *of_node; - - /* Re-enable 1394 */ - of_node = pci_device_to_OF_node (pdev); - if (of_node) - pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1); - } -#endif /* CONFIG_PPC_PMAC */ - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - err = pci_enable_device(pdev); - if (err) - return err; - - ohci = pci_get_drvdata(pdev); - if (!ohci) - return -1; /* or which exit status to use? */ - - PRINT(KERN_DEBUG, "resume called"); - - /* The following lines are copied from ohci1394_pci_probe(): */ - - /* Start off with a soft reset, to clear everything to a sane - * state. */ - ohci_soft_reset(ohci); - - /* Now enable LPS, which we need in order to start accessing - * most of the registers. In fact, on some cards (ALI M5251), - * accessing registers in the SClk domain without LPS enabled - * will lock up the machine. Wait 50msec to make sure we have - * full link enabled. */ - reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); - - /* Disable and clear interrupts */ - reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); - reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); - - mdelay(50); - - ohci_initialize(ohci); - - return 0; -} - -static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state) -{ - int err; - struct ti_ohci *ohci; - - ohci = pci_get_drvdata(pdev); - if (!ohci) - return -1; /* Not sure if this is the correct return code */ + struct ti_ohci *ohci = pci_get_drvdata(pdev); PRINT(KERN_DEBUG, "suspend called"); + if (!ohci) + return -ENXIO; - /* clear the async DMA contexts and stop using the controller: */ + /* Clear the async DMA contexts and stop using the controller */ hpsb_bus_reset(ohci->host); - /* The following calls are from ohci1394_pci_remove(): */ - - /* Clear out BUS Options */ + /* See ohci1394_pci_remove() for comments on this sequence */ reg_write(ohci, OHCI1394_ConfigROMhdr, 0); reg_write(ohci, OHCI1394_BusOptions, (reg_read(ohci, OHCI1394_BusOptions) & 0x0000f007) | 0x00ff0000); - - /* Clear interrupt registers */ reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff); reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff); reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff); reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff); - - /* Disable IRM Contender */ set_phy_reg(ohci, 4, ~0xc0 & get_phy_reg(ohci, 4)); - - /* Clear link control register */ reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff); - - /* Let all other nodes know to ignore us */ ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); - - /* This stops all DMA contexts, disables interrupts, - * and clears linkEnable and LPS: */ ohci_soft_reset(ohci); err = pci_save_state(pdev); if (err) - goto out; + return err; err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); if (err) - goto out; + return err; /* PowerMac suspend code comes last */ #ifdef CONFIG_PPC_PMAC @@ -3643,8 +3575,46 @@ static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state) pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); } #endif /* CONFIG_PPC_PMAC */ -out: - return err; + + return 0; +} + +static int ohci1394_pci_resume(struct pci_dev *pdev) +{ + int err; + struct ti_ohci *ohci = pci_get_drvdata(pdev); + + PRINT(KERN_DEBUG, "resume called"); + if (!ohci) + return -ENXIO; + +/* PowerMac resume code comes first */ +#ifdef CONFIG_PPC_PMAC + if (machine_is(powermac)) { + struct device_node *of_node; + + /* Re-enable 1394 */ + of_node = pci_device_to_OF_node (pdev); + if (of_node) + pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1); + } +#endif /* CONFIG_PPC_PMAC */ + + pci_set_power_state(pdev, PCI_D0); + pci_restore_state(pdev); + err = pci_enable_device(pdev); + if (err) + return err; + + /* See ohci1394_pci_probe() for comments on this sequence */ + ohci_soft_reset(ohci); + reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); + reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); + reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); + mdelay(50); + ohci_initialize(ohci); + + return 0; } #endif /* CONFIG_PM */ -- cgit v1.2.3-70-g09d2 From 2a3f8ad3a94c784f57958bd692428cb342ce4114 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sun, 29 Oct 2006 19:52:49 +0100 Subject: ieee1394: ohci1394: revert fail on error in suspend Some errors during preparation for suspended state can be skipped with a warning instead of a failure of the whole suspend transition, notably an error in pci_set_power_state. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index a12802553b4..44adefd7168 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3534,6 +3534,9 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) int err; struct ti_ohci *ohci = pci_get_drvdata(pdev); + printk(KERN_INFO "%s does not fully support suspend and resume yet\n", + OHCI1394_DRIVER_NAME); + PRINT(KERN_DEBUG, "suspend called"); if (!ohci) return -ENXIO; @@ -3558,11 +3561,17 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) ohci_soft_reset(ohci); err = pci_save_state(pdev); - if (err) + if (err) { + printk(KERN_ERR "%s: pci_save_state failed with %d\n", + OHCI1394_DRIVER_NAME, err); return err; + } err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); +#ifdef OHCI1394_DEBUG if (err) - return err; + printk(KERN_DEBUG "%s: pci_set_power_state failed with %d\n", + OHCI1394_DRIVER_NAME, err); +#endif /* OHCI1394_DEBUG */ /* PowerMac suspend code comes last */ #ifdef CONFIG_PPC_PMAC -- cgit v1.2.3-70-g09d2 From 5f8d17f6023ea9aca7c0063c5b472529f2664944 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sun, 29 Oct 2006 19:58:25 +0100 Subject: ieee1394: ohci1394: proper log messages in suspend and resume - correct thinko in one of my last commits: cannot use PRINT macro with ohci == NULL - add log messages on ohci == NULL and on pci_enable_device != 0 - update log macros from patch "revert fail on error in suspend" to use PRINT and DBGMSG where possible Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 44adefd7168..406b7501b9b 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3537,9 +3537,12 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) printk(KERN_INFO "%s does not fully support suspend and resume yet\n", OHCI1394_DRIVER_NAME); - PRINT(KERN_DEBUG, "suspend called"); - if (!ohci) + if (!ohci) { + printk(KERN_ERR "%s: tried to suspend nonexisting host\n", + OHCI1394_DRIVER_NAME); return -ENXIO; + } + DBGMSG("suspend called"); /* Clear the async DMA contexts and stop using the controller */ hpsb_bus_reset(ohci->host); @@ -3562,16 +3565,12 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) err = pci_save_state(pdev); if (err) { - printk(KERN_ERR "%s: pci_save_state failed with %d\n", - OHCI1394_DRIVER_NAME, err); + PRINT(KERN_ERR, "pci_save_state failed with %d", err); return err; } err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); -#ifdef OHCI1394_DEBUG if (err) - printk(KERN_DEBUG "%s: pci_set_power_state failed with %d\n", - OHCI1394_DRIVER_NAME, err); -#endif /* OHCI1394_DEBUG */ + DBGMSG("pci_set_power_state failed with %d", err); /* PowerMac suspend code comes last */ #ifdef CONFIG_PPC_PMAC @@ -3593,9 +3592,12 @@ static int ohci1394_pci_resume(struct pci_dev *pdev) int err; struct ti_ohci *ohci = pci_get_drvdata(pdev); - PRINT(KERN_DEBUG, "resume called"); - if (!ohci) + if (!ohci) { + printk(KERN_ERR "%s: tried to resume nonexisting host\n", + OHCI1394_DRIVER_NAME); return -ENXIO; + } + DBGMSG("resume called"); /* PowerMac resume code comes first */ #ifdef CONFIG_PPC_PMAC @@ -3612,8 +3614,10 @@ static int ohci1394_pci_resume(struct pci_dev *pdev) pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev); err = pci_enable_device(pdev); - if (err) + if (err) { + PRINT(KERN_ERR, "pci_enable_device failed with %d", err); return err; + } /* See ohci1394_pci_probe() for comments on this sequence */ ohci_soft_reset(ohci); -- cgit v1.2.3-70-g09d2 From c0f00e279712923cc945604d29a252e52c7838e1 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Mon, 30 Oct 2006 15:51:52 +0300 Subject: ohci1394: shortcut irq printing To print irq number no need to transform to string using %d, then print using %s. Just use %d. Signed-off-by: Alexey Dobriyan --- drivers/ieee1394/ohci1394.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 406b7501b9b..b8e922b65e2 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -468,7 +468,6 @@ static int get_nb_iso_ctx(struct ti_ohci *ohci, int reg) /* Global initialization */ static void ohci_initialize(struct ti_ohci *ohci) { - char irq_buf[16]; quadlet_t buf; int num_ports, i; @@ -586,11 +585,10 @@ static void ohci_initialize(struct ti_ohci *ohci) reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_linkEnable); buf = reg_read(ohci, OHCI1394_Version); - sprintf (irq_buf, "%d", ohci->dev->irq); - PRINT(KERN_INFO, "OHCI-1394 %d.%d (PCI): IRQ=[%s] " + PRINT(KERN_INFO, "OHCI-1394 %d.%d (PCI): IRQ=[%d] " "MMIO=[%llx-%llx] Max Packet=[%d] IR/IT contexts=[%d/%d]", ((((buf) >> 16) & 0xf) + (((buf) >> 20) & 0xf) * 10), - ((((buf) >> 4) & 0xf) + ((buf) & 0xf) * 10), irq_buf, + ((((buf) >> 4) & 0xf) + ((buf) & 0xf) * 10), ohci->dev->irq, (unsigned long long)pci_resource_start(ohci->dev, 0), (unsigned long long)pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1, ohci->max_packet_size, -- cgit v1.2.3-70-g09d2 From 48cfae44b4d6c7ca843d611a93ed2f94b59bcb38 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 11 Nov 2006 00:22:35 +0100 Subject: ieee1394: ohci1394: add PPC_PMAC platform code to driver probe Fixes http://bugzilla.kernel.org/show_bug.cgi?id=7431 iBook G3 threw a machine check exception and put the display backlight to full brightness after ohci1394 was unloaded and reloaded. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index b8e922b65e2..453d0be694e 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3215,6 +3215,19 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, struct ti_ohci *ohci; /* shortcut to currently handled device */ resource_size_t ohci_base; +#ifdef CONFIG_PPC_PMAC + /* Necessary on some machines if ohci1394 was loaded/ unloaded before */ + if (machine_is(powermac)) { + struct device_node *of_node = pci_device_to_OF_node(dev); + + if (of_node) { + pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, of_node, + 0, 1); + pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 1); + } + } +#endif /* CONFIG_PPC_PMAC */ + if (pci_enable_device(dev)) FAIL(-ENXIO, "Failed to enable OHCI hardware"); pci_set_master(dev); @@ -3503,10 +3516,8 @@ static void ohci1394_pci_remove(struct pci_dev *pdev) #endif #ifdef CONFIG_PPC_PMAC - /* On UniNorth, power down the cable and turn off the chip - * clock when the module is removed to save power on - * laptops. Turning it back ON is done by the arch code when - * pci_enable_device() is called */ + /* On UniNorth, power down the cable and turn off the chip clock + * to save power on laptops */ { struct device_node* of_node; -- cgit v1.2.3-70-g09d2 From 5370f1f5e94f1734f0706044bfb95007ea90fb23 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 11 Nov 2006 00:23:50 +0100 Subject: ieee1394: ohci1394: reformat PPC_PMAC platform code Adjust whitespace and line lengths Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 453d0be694e..3c9dc7d2441 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3218,12 +3218,11 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, #ifdef CONFIG_PPC_PMAC /* Necessary on some machines if ohci1394 was loaded/ unloaded before */ if (machine_is(powermac)) { - struct device_node *of_node = pci_device_to_OF_node(dev); + struct device_node *ofn = pci_device_to_OF_node(dev); - if (of_node) { - pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, of_node, - 0, 1); - pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 1); + if (ofn) { + pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 1); + pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); } } #endif /* CONFIG_PPC_PMAC */ @@ -3519,12 +3518,11 @@ static void ohci1394_pci_remove(struct pci_dev *pdev) /* On UniNorth, power down the cable and turn off the chip clock * to save power on laptops */ { - struct device_node* of_node; + struct device_node* ofn = pci_device_to_OF_node(ohci->dev); - of_node = pci_device_to_OF_node(ohci->dev); - if (of_node) { - pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); - pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, of_node, 0, 0); + if (ofn) { + pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); + pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0); } } #endif /* CONFIG_PPC_PMAC */ @@ -3584,12 +3582,10 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) /* PowerMac suspend code comes last */ #ifdef CONFIG_PPC_PMAC if (machine_is(powermac)) { - struct device_node *of_node; + struct device_node *ofn = pci_device_to_OF_node(pdev); - /* Disable 1394 */ - of_node = pci_device_to_OF_node (pdev); - if (of_node) - pmac_call_feature(PMAC_FTR_1394_ENABLE, of_node, 0, 0); + if (ofn) + pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); } #endif /* CONFIG_PPC_PMAC */ @@ -3611,12 +3607,10 @@ static int ohci1394_pci_resume(struct pci_dev *pdev) /* PowerMac resume code comes first */ #ifdef CONFIG_PPC_PMAC if (machine_is(powermac)) { - struct device_node *of_node; + struct device_node *ofn = pci_device_to_OF_node(pdev); - /* Re-enable 1394 */ - of_node = pci_device_to_OF_node (pdev); - if (of_node) - pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1); + if (ofn) + pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); } #endif /* CONFIG_PPC_PMAC */ -- cgit v1.2.3-70-g09d2 From 63cca59e89892497e95e1e9c7156d3345fb7e2e8 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 11 Nov 2006 00:26:24 +0100 Subject: ieee1394: ohci1394: call PMac code in shutdown only for proper machines There has been an if(...) missing, for ages. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/ieee1394/ohci1394.c') diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 3c9dc7d2441..628130a58af 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -3517,7 +3517,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev) #ifdef CONFIG_PPC_PMAC /* On UniNorth, power down the cable and turn off the chip clock * to save power on laptops */ - { + if (machine_is(powermac)) { struct device_node* ofn = pci_device_to_OF_node(ohci->dev); if (ofn) { -- cgit v1.2.3-70-g09d2