All of lore.kernel.org
 help / color / mirror / Atom feed
From: mark gross <mgross@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>, Greg KH <greg@kroah.com>,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH]add private data to struct notifier_bock
Date: Mon, 14 Apr 2008 13:05:01 -0700	[thread overview]
Message-ID: <20080414200501.GA29123@linux.intel.com> (raw)
In-Reply-To: <1208196249.7164.7.camel@twins>

On Mon, Apr 14, 2008 at 08:04:09PM +0200, Peter Zijlstra wrote:
> On Mon, 2008-04-14 at 09:19 -0700, mark gross wrote:
> > I am working with one of the iwl4965 developers to add pm_qos based
> > power management to its power states.  We relalized that the block
> > notifier I used in the PM_QOS has no way of passing in any driver device
> > instance data.  In this case the developer expected the notification
> > call backs to call the iwl4965 notification function with an instance
> > pointer to the correct *dev.
> > 
> > Poking around I've noticed a handful of drivers using notifications that
> > seem to keep a list of instance pointers around so it can plug into the
> > notification infrastructure.  including : ipmi_msghandler.c adb_hid.c
> > md.c ips.c
> > 
> > As having a registered call back called with a private data pointer set
> > up at registration time  is such a common idiom I thought it might be a
> > good thing to add a private_data pointer to the struct notifier_block
> > and add the interfaces needed to pass the private data as the
> > notification chain is processed.
> 
> How is:
> 
> struct my_device_thingy {
> 	...
> 	struct notifier_block my_notifier;
> 	...
> };
> 
> int my_device_notifier_call(struct notifier_block *nb, unsigned long val
> 			    void *data)
> {
> 	struct my_device_thingy *mdt = container_of(nb, struct
> 				 my_device_thingy, my_notifier);
> 
> 	...
> }
> 
> not sufficient?

Because ... um....a.... that would work too.  

Please ignore my last patch.

Thanks!

--mgross


      reply	other threads:[~2008-04-14 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 16:19 [PATCH]add private data to struct notifier_bock mark gross
2008-04-14 18:04 ` Peter Zijlstra
2008-04-14 20:05   ` mark gross [this message]

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=20080414200501.GA29123@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /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.