From: Maxim <maximlevitsky@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: netdev@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume
Date: Sun, 18 Feb 2007 00:29:03 +0200 [thread overview]
Message-ID: <200702180029.03651.maximlevitsky@gmail.com> (raw)
In-Reply-To: <20070217115029.GF9120@elf.ucw.cz>
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.000000000 +0200
+++ linux-2.6.20-test/drivers/net/tulip/dmfe.c 2007-02-15 18:26:34.000000000 +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, sten_wang@davicom.com.tw");
next prev parent reply other threads:[~2007-02-17 22:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-15 20:53 [PATCH 2.6.20 000/005] [RESEND v2] dmfe: number of fixes and features Maxim
2007-02-15 20:55 ` [PATCH 2.6.20 001/005] [RESEND v2] dmfe : trivial/spelling fixes Maxim
2007-02-15 21:04 ` [PATCH 2.6.20 002/005] [RESEND v2] dmfe : Fix two bugs Maxim
2007-02-15 21:08 ` Subject: [PATCH 2.6.20 003/005] [RESEND v2] dmfe: Fix link detection Maxim
2007-02-15 21:11 ` Subject: [PATCH 2.6.20 004/005] dmfe: Add support for suspend/resume Maxim
2007-02-17 11:50 ` Pavel Machek
2007-02-17 22:29 ` Maxim [this message]
2007-02-17 22:52 ` Pavel Machek
2007-02-18 13:43 ` Maxim
2007-02-19 11:41 ` Pavel Machek
2007-02-15 21:16 ` [PATCH 2.6.20 005/005] [RESEND v2] dmfe: add support for Wake on lan Maxim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702180029.03651.maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.