Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
>From Maxim Levitsky <[EMAIL PROTECTED]> Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume This adds support for suspend resume Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]> --- --- linux-2.6.20-mod/drivers/net/tulip/dmfe.c 2007-02-15 18:24:47.0 +0200 +++ linux-2.6.20-test/drivers/net/tulip/dmfe.c 2007-02-15 18:26:34.0 +0200 @@ -55,9 +55,6 @@ TODO -Implement pci_driver::suspend() and pci_driver::resume() -power management methods. - Check on 64 bit boxes. Check and fix on big endian boxes. @@ -2050,11 +2047,56 @@ static struct pci_device_id dmfe_pci_tbl MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); + +static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) +{ + struct net_device *dev = pci_get_drvdata(pci_dev); + struct dmfe_board_info *db = netdev_priv(dev); + + /* Disable upper layer interface */ + netif_device_detach (dev); + + /* Disable Tx/Rx */ + db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); + update_cr6(db->cr6_data, dev->base_addr); + + /* Disable Interrupt */ + outl (0, dev->base_addr + DCR7); + outl (inl (dev->base_addr + DCR5), dev->base_addr + DCR5); + + /* Fre RX buffers */ + dmfe_free_rxbuffer (db); + + /* Power down device*/ + pci_set_power_state (pci_dev, pci_choose_state (pci_dev,state)); + pci_save_state (pci_dev); + + return 0; +} + +static int dmfe_resume (struct pci_dev *pci_dev) +{ + struct net_device *dev = pci_get_drvdata (pci_dev); + + pci_restore_state(pci_dev); + pci_set_power_state(pci_dev ,PCI_D0); + + /* Re-initilize DM910X board */ + dmfe_init_dm910x(dev); + + /* Restart upper layer interface */ + netif_device_attach(dev); + + return 0; +} + static struct pci_driver dmfe_driver = { .name = "dmfe", .id_table = dmfe_pci_tbl, .probe = dmfe_init_one, .remove = __devexit_p(dmfe_remove_one), + .suspend= dmfe_suspend, + .resume = dmfe_resume }; MODULE_AUTHOR("Sten Wang, [EMAIL PROTECTED]"); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
Hi! > @@ -2050,11 +2047,56 @@ static struct pci_device_id dmfe_pci_tbl > MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); > > > + > +static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) > +{ > + struct net_device *dev = pci_get_drvdata(pci_dev); > + struct dmfe_board_info *db = netdev_priv(dev); > + > + /* Disable upper layer interface */ > + netif_device_detach (dev); > + > + /* Disable Tx/Rx */ > + db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); > + update_cr6(db->cr6_data, dev->base_addr); > + > + /* Disable Interrupt */ > + outl (0, dev->base_addr + DCR7); > + outl (inl (dev->base_addr + DCR5), dev->base_addr + DCR5); Please no space between function and "(". > + /* Fre RX buffers */ Free? > + dmfe_free_rxbuffer (db); > + /* Power down device*/ " */" > + pci_set_power_state (pci_dev, pci_choose_state (pci_dev,state)); Let it be ", state", and delete spaces between function and "(". > +static int dmfe_resume (struct pci_dev *pci_dev) delete spaces between function and "(". > + pci_restore_state(pci_dev); > + pci_set_power_state(pci_dev ,PCI_D0); > + ", " Otherwise looks ok to me. -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
On Saturday 17 February 2007 13:50:29 Pavel Machek wrote: > Hi! > > > @@ -2050,11 +2047,56 @@ static struct pci_device_id dmfe_pci_tbl > > MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); > > > > > > + > > +static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) > > +{ > > + struct net_device *dev = pci_get_drvdata(pci_dev); > > + struct dmfe_board_info *db = netdev_priv(dev); > > + > > + /* Disable upper layer interface */ > > + netif_device_detach (dev); > > + > > + /* Disable Tx/Rx */ > > + db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); > > + update_cr6(db->cr6_data, dev->base_addr); > > + > > + /* Disable Interrupt */ > > + outl (0, dev->base_addr + DCR7); > > + outl (inl (dev->base_addr + DCR5), dev->base_addr + DCR5); > > Please no space between function and "(". I missed that part of coding style about no space after function name > > > + /* Fre RX buffers */ > > Free? Of course :-) > > > + dmfe_free_rxbuffer (db); > > > + /* Power down device*/ > > " */" > > > + pci_set_power_state (pci_dev, pci_choose_state (pci_dev,state)); > > Let it be ", state", and delete spaces between function and "(". Sure > > > > +static int dmfe_resume (struct pci_dev *pci_dev) > > delete spaces between function and "(". > > > + pci_restore_state(pci_dev); > > + pci_set_power_state(pci_dev ,PCI_D0); > > + > > ", " > > Otherwise looks ok to me. > Hello , I am sorry that I missed some parts of coding style. I need to reread it :-) There is a updated patch : --- linux-2.6.20-mod/drivers/net/tulip/dmfe.c 2007-02-15 18:24:47.0 +0200 +++ linux-2.6.20-test/drivers/net/tulip/dmfe.c 2007-02-15 18:26:34.0 +0200 @@ -55,9 +55,6 @@ TODO -Implement pci_driver::suspend() and pci_driver::resume() -power management methods. - Check on 64 bit boxes. Check and fix on big endian boxes. @@ -2050,11 +2047,56 @@ static struct pci_device_id dmfe_pci_tbl MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl); + +static int dmfe_suspend(struct pci_dev *pci_dev, pm_message_t state) +{ + struct net_device *dev = pci_get_drvdata(pci_dev); + struct dmfe_board_info *db = netdev_priv(dev); + + /* Disable upper layer interface */ + netif_device_detach(dev); + + /* Disable Tx/Rx */ + db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); + update_cr6(db->cr6_data, dev->base_addr); + + /* Disable Interrupt */ + outl (0, dev->base_addr + DCR7); + outl (inl(dev->base_addr + DCR5), dev->base_addr + DCR5); + + /* Free RX buffers */ + dmfe_free_rxbuffer(db); + + /* Power down device*/ + pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); + pci_save_state(pci_dev); + + return 0; +} + +static int dmfe_resume(struct pci_dev *pci_dev) +{ + struct net_device *dev = pci_get_drvdata(pci_dev); + + pci_restore_state(pci_dev); + pci_set_power_state(pci_dev, PCI_D0); + + /* Re-initialize DM910X board */ + dmfe_init_dm910x(dev); + + /* Restart upper layer interface */ + netif_device_attach(dev); + + return 0; +} + static struct pci_driver dmfe_driver = { .name = "dmfe", .id_table = dmfe_pci_tbl, .probe = dmfe_init_one, .remove = __devexit_p(dmfe_remove_one), + .suspend= dmfe_suspend, + .resume = dmfe_resume }; MODULE_AUTHOR("Sten Wang, [EMAIL PROTECTED]"); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
Hi! > > Hello , I am sorry that I missed some parts of coding style. I need to > reread it :-) > > There is a updated patch : It looks better. > + /* Disable Interrupt */ > + outl (0, dev->base_addr + DCR7); > + outl (inl(dev->base_addr + DCR5), dev->base_addr + DCR5); I'd kill space after outl... > + /* Free RX buffers */ > + dmfe_free_rxbuffer(db); > + > + /* Power down device*/ and add space before */. Congratulation, you passed coding-style-police-check ;-). Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
On Sunday 18 February 2007 00:52:15 Pavel Machek wrote: > Hi! > > > > Hello , I am sorry that I missed some parts of coding style. I need to > > reread it :-) > > > > There is a updated patch : > > It looks better. > > > + /* Disable Interrupt */ > > + outl (0, dev->base_addr + DCR7); > > + outl (inl(dev->base_addr + DCR5), dev->base_addr + DCR5); > > I'd kill space after outl... > > > + /* Free RX buffers */ > > + dmfe_free_rxbuffer(db); > > + > > + /* Power down device*/ > > and add space before */. > > Congratulation, you passed coding-style-police-check ;-). > Pavel > Hello, Thanks for reply, I just want to ask one question: Those patches are now merged in -mm, and I noticed that Andrew Morton after applying them did fix my bad coding style and check for CONFIG_PM=n that I didn't include Now should I resend two last patches or not ? Regards, Maxim Levitsky PS: Actualy I have planned to send those patches a little bit later , and do more checks like the coding style stuff, mailer problems, etc... but I noticed that 2.6.20 breaks link detection on my card, and I even saw report here on LKML about that, so I decided to send them now Of cource I did check them for code correctness , and I actualy used them for about a month. I tried to do as little as possible changes, and verify each line. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
Hi! > > and add space before */. > > > > Congratulation, you passed coding-style-police-check ;-). > > Pavel > > > > Hello, > Thanks for reply, I just want to ask one question: > > Those patches are now merged in -mm, and I noticed that Andrew Morton > after applying them did fix my bad coding style and check for CONFIG_PM=n > that I didn't include > Now should I resend two last patches or not ? Well, i guess you should wait for next -mm tree, and if you see some problem you fixed and akpm did not, fix it and send a incremental patch... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/