[i2c] [PATCH] Lifebook apanel driver

Jean Delvare khali at linux-fr.org
Fri Jan 5 13:38:02 CET 2007


One more thing...

> > +#ifdef CONFIG_PM
> > +/* If input device was opened, then stop polling */
> > +static int apanel_suspend(struct device *dev, pm_message_t state)
> > +{
> > +	struct i2c_client *client = container_of(dev, struct i2c_client, dev);

Use to_i2c_client().

> > +	struct apanel *ap = i2c_get_clientdata(client);
> > +	struct input_dev *input = ap->input;
> > +
> > +	mutex_lock(&input->mutex);
> > +	if (input->users)
> > +		cancel_rearming_delayed_work(&ap->poll_timer);
> > +	mutex_unlock(&input->mutex);
> > +	return 0;
> > +}
> > +
> > +/* If input device was opened, then resume polling */
> > +static int apanel_resume(struct device *dev)
> > +{
> > +	struct i2c_client *client = container_of(dev, struct i2c_client, dev);

Same here.

> > +	struct apanel *ap = i2c_get_clientdata(client);
> > +	struct input_dev *input = ap->input;
> > +
> > +	mutex_lock(&input->mutex);
> > +	if (input->users)
> > +		schedule_delayed_work(&ap->poll_timer, POLL_FREQUENCY);
> > +	mutex_unlock(&input->mutex);
> > +	return 0;
> > +}
> > +#endif

BTW, you get warnings when these are called, don't you? The i2c core
currently doesn't comply with the new power management standard,
although this should be addressed really soon now, at which point your
driver will need to be updated.

-- 
Jean Delvare



More information about the i2c mailing list