lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1208196249.7164.7.camel@twins>
Date:	Mon, 14 Apr 2008 20:04:09 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	mgross@...ux.intel.com
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	lkml <linux-kernel@...r.kernel.org>, Greg KH <greg@...ah.com>,
	Arjan van de Ven <arjan@...ux.intel.com>
Subject: Re: [PATCH]add private data to struct notifier_bock

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?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ