lkml.org 
[lkml]   [2008]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] pcmcia: Fix broken abuse of dev->driver_data
Alan,

(CC: linux-pcmcia added)

Many thanks for finding this bug.

On Mon, Sep 22, 2008 at 03:58:14PM +0100, Alan Cox wrote:
> PCMCIA abuses dev->private_data in the probe methods. Unfortunately it
> continues to abuse it after calling drv->probe() which leads to crashes and
> other nasties (such as bogus probes of multifunction devices) giving errors like

Well, PCMCIA drivers have (struct pcmcia_device *) p_dev->priv available and
use this regularly, so using dev->private_data never has been supported.
Nonetheless, let's add support for using dev->private_data also for PCMCIA
devices and remove p_dev->priv eventually.

> As its close to the final release just move the hack so it works out,
> hopefully someone will be sufficiently embarrassed to produce a nice rework
> for 2.6.28.

Could you remove this from the changelog entry, please?


> @@ -426,6 +426,18 @@ static int pcmcia_device_probe(struct device * dev)
> p_dev = to_pcmcia_dev(dev);
> p_drv = to_pcmcia_drv(dev->driver);
> s = p_dev->socket;
> +

trailing whitespace

> + /* The PCMCIA code passes the match data in via dev->driver_data
> + * which is an ugly hack. Once the driver probe is called it may
> + * and often will overwrite the match data so we must save it first

trailing whitespace

> if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
> (p_dev->socket->device_count == 1) && (p_dev->device_no ==
> 0)) pcmcia_add_device_later(p_dev->socket, 0);

uh?

>
> - put_module:
> +put_module:
> if (ret)
> module_put(p_drv->owner);
> - put_dev:
> +put_dev:

unrelated -- please do not change it this time.

Best and thanks again,

Dominik


\
 
 \ /
  Last update: 2008-09-22 23:59    [W:0.012 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site