Re: [PATCH] drivers:staging: sources for ST core

From: Alan Cox
Date: Thu Apr 01 2010 - 05:16:17 EST


> +/*
> + * function to return whether the firmware response was proper
> + * in case of error don't complete so that waiting for proper
> + * response times out
> + */
> +void validate_firmware_response(struct sk_buff *skb)
> +{
> + if (unlikely(skb->data[5] != 0)) {
> + pr_err("no proper response during fw download");
> + pr_err("data6 %x", skb->data[5]);

In this driver you do know the device so you need to be using dev_ and
passing around dev (or something that gives you dev).

> +static int kim_probe(struct platform_device *pdev)
> +{
> + long status;
> + long proto;
> + long *gpios = pdev->dev.platform_data;
> +
> + status = st_core_init(&kim_gdata->core_data);

I would expect any truely global data to be configured in the module init
and then device specific data you want to do something like this

kim_data = kzalloc(sizeof(something), GFP_KERNEL);

..

kim_data_init(&pdev->dev, kim_data);
dev_set_drvdata(&pdev->dev, kim_data);

Elsewhere you can now do

kim_data = dev_get_drvdata(&pdev->dev);

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