public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Shaohua Li <shaohua.li@intel.com>
Cc: Greg KH <greg@kroah.com>, Andrew Morton <akpm@osdl.org>,
	linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>,
	lkml <linux-kernel@vger.kernel.org>,
	Rajesh Shah <rajesh.shah@intel.com>
Subject: Re: [PATCH 1/2]MSI(X) save/restore for suspend/resume
Date: Wed, 11 Jan 2006 19:47:32 -0700	[thread overview]
Message-ID: <20060112024732.GE19769@parisc-linux.org> (raw)
In-Reply-To: <1137033060.5750.68.camel@sli10-desk.sh.intel.com>

On Thu, Jan 12, 2006 at 10:30:59AM +0800, Shaohua Li wrote:

Did you not understand my comment about using the hlist functions?

> +struct pci_cap_saved_state {
> +	struct list_head next;

struct hlist_node list;

> +	char cap_nr;
> +	u32 data[0];
> +};

>  	u32		saved_config_space[16]; /* config space saved at suspend time */
> +	struct list_head saved_cap_space; /* extend config space saved at suspend */

struct hlist_head saved_cap_space;

BTW, the comment is confusing and wrong.  Extended config space is
0x100-0xfff.  How about simply:

/* Capabilities saved on suspend */

Or even omit it.  I think it's pretty obvious what "saved_cap_space" is.

> +static inline struct pci_cap_saved_state *pci_find_saved_cap(
> +	struct pci_dev *pci_dev,char cap)
> +{
> +	struct pci_cap_saved_state *tmp;
> +
> +	list_for_each_entry(tmp, &pci_dev->saved_cap_space, next) {

hlist_for_each_entry

> +		if (tmp->cap_nr == cap)
> +			return tmp;
> +	}
> +	return NULL;
> +}
> +
> +static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
> +	struct pci_cap_saved_state *new_cap)
> +{
> +	list_add(&new_cap->next, &pci_dev->saved_cap_space);

hlist_add_head

> +}
> +
> +static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
> +{
> +	list_del(&cap->next);

hlist_del

> +}
> +
>  /*
>   *  For PCI devices, the region numbers are assigned this way:
>   *
> diff -puN drivers/pci/probe.c~msi_save_restore drivers/pci/probe.c
> --- linux-2.6.15-rc5/drivers/pci/probe.c~msi_save_restore	2006-01-12 10:12:00.000000000 +0800
> +++ linux-2.6.15-rc5-root/drivers/pci/probe.c	2006-01-12 10:12:55.000000000 +0800
> @@ -788,6 +788,7 @@ void __devinit pci_device_add(struct pci
>  	/* Fix up broken headers */
>  	pci_fixup_device(pci_fixup_header, dev);
>  
> +	INIT_LIST_HEAD(&dev->saved_cap_space);

and while you could use INIT_HLIST_HEAD, you shouldn't need to since an
empty hlist is NULL.

  reply	other threads:[~2006-01-12  2:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-27  2:05 [PATCH 1/2]MSI(X) save/restore for suspend/resume Shaohua Li
2005-12-27  7:55 ` Arjan van de Ven
2005-12-28  1:24   ` Shaohua Li
2005-12-28  8:25     ` Arjan van de Ven
2005-12-28  8:28       ` Shaohua Li
2006-01-04  7:13 ` Andrew Morton
2006-01-05  0:58   ` Shaohua Li
2006-01-10 20:15     ` Greg KH
2006-01-10 20:28     ` Matthew Wilcox
2006-01-11  1:17       ` Shaohua Li
2006-01-11  1:26         ` Greg KH
2006-01-11  8:18           ` Shaohua Li
2006-01-11 15:20             ` Matthew Wilcox
2006-01-11 15:51             ` Greg KH
2006-01-11 18:39               ` Matthew Wilcox
2006-01-12  2:30               ` Shaohua Li
2006-01-12  2:47                 ` Matthew Wilcox [this message]
2006-01-12  3:17                   ` Shaohua Li
2006-01-12  7:12                     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-02-08  9:11 Shaohua Li
2006-02-21  5:24 ` Greg KH
2006-02-22  8:13   ` Shaohua Li

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=20060112024732.GE19769@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=rajesh.shah@intel.com \
    --cc=shaohua.li@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox