diff mbox

Tracking N770 breakage

Message ID 20090523123040.16971ty5wndy6mow@lidskialf.net (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Andrew de Quincey May 23, 2009, 11:30 a.m. UTC
Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:

> Quoting Tony Lindgren <tony@atomide.com>:
>
>> * Andrew de Quincey <adq@lidskialf.net> [090522 18:39]:
>>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>>
>>>> Quoting Andrew de Quincey <adq@lidskialf.net>:
>>>>
>>>>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>>>>
>>>>>> Quoting Tony Lindgren <tony@atomide.com>:
>>>>>>
>>>>>>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090519 22:15]:
>>>>>>>> Quoting Tony Lindgren <tony@atomide.com>:
>>>>>>>>
>>>>>>>>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090516 19:17]:
>>>>>>>>>> Argh, my N770 seems to have just died; it has been behaving slightly
>>>>>>>>>> oddly and now it simply won't turn on (black screen and no  
>>>>>>>>>> sign of life
>>>>>>>>>> whatsoever).
>>>>>>>>>>
>>>>>>>>>> It is well out of warranty and frankly I don't see myself
>>>>>>>>>> buying another
>>>>>>>>>> one, so this effectively ends my hacking on it :(
>>>>>>>>>
>>>>>>>>> Bummer :(
>>>>>>>>>
>>>>>>>>> After a quick try, CONFIG_OMAP_RESET_CLOCKS was the first  
>>>>>>>>> stopper, then
>>>>>>>>> it could not mount the MMC root.
>>>>>>>>
>>>>>>>> Ahh excellent, that was why I posted my progress, in case it  
>>>>>>>> rang a bell
>>>>>>>> with anyone! I think the touchpad driver may be broken as well BTW.
>>>>>>>>
>>>>>>>>> I think there was a patch posted for the omap1 MMC by
>>>>>>>>> Ladislav few months
>>>>>>>>> ago that probably fixes it.
>>>>>>>>
>>>>>>>> Cool - I hope I may be back in the running soon (I was rather annoyed
>>>>>>>> when I posted that message!); I've ordered a new battery in case its
>>>>>>>> just that. A kind person has also offered me one thats broken in a
>>>>>>>> different way that I can probably cobble together with the remains of
>>>>>>>> mine if its something more critical that has died.
>>>>>>>
>>>>>>> Good to hear, let's hope it just needs a new battery.
>>>>>>>
>>>>>>> See also the n8x0 thread. If we get drivers/cbus to mainline, we
>>>>>>> pretty much have everything we need for 770 in mainline too.
>>>>>>>
>>>>>>> It would be nice to get the drivers/mmc/host/omap.c patch integrated
>>>>>>> for 2.6.30 to make omap1 MMC work again. Ladislav, any news on that?
>>>>>>
>>>>>> OK! My friend has lent me his N770 in the meantime so I can get
>>>>>> going again. It seems the board is fried on mine as my battery
>>>>>> works perfectly fine in his. gah!
>>>>>>
>>>>>> Anyway, I have just tried disabling RESET_CLOCKS, but it still
>>>>>> doesn't work for me with the very latest linux-omap-2.6.
>>>>>>
>>>>>> With my HWA patch applied, at least the screen goes black, but I
>>>>>> don't see any console output, and the thing doesn't appear as a
>>>>>> USB gadget (I'm mounting NFS as root over USB with cdc_ether).
>>>>>>
>>>>>> I wish the thing had an LED I could turn on! Hmm, I wonder if I
>>>>>> could turn off the backlight easily..
>>>>>
>>>>> Actually, after playing a bit, I discovered I'm getting a boot
>>>>> penguin logo ok, but no actual textual console output; weird!
>>>>
>>>> I feel really silly; the N770's bootloader had "serial-console"
>>>> enabled, which meant all the kernel messages were being sent out that
>>>> instead of being displayed on the fb. So I can now see WTF is going on!
>>>>
>>>> Next problem for me: ohci-hcd.c is reporting an initialisation error
>>>> in the latest kernels, which is why my NFS-over-USB mount fails. I
>>>> can't see any changes in the initialisation *values* used, but there
>>>> have obviously been the "kill OMAP_TAG_USB" changes; I'm wondering if
>>>> its some initialisation ordering problem.
>>>
>>> OK got it, it IS a timing problem, due to non-ARM changes in the core
>>> kernel (possibly the recent async subsystem startup improvements?).
>>>
>>> In the middle of the boot with a recent kernel, I see a message
>>> "tahvo-usb: no tahvo_otg_dev" coming from
>>> drivers/cbus/tahvo-usb.c/omap_otg_init(). This is because the internal
>>> field "tahvo_otg_dev" is NULL. In turn, omap_otg_init() is being called
>>> by tahvo_usb_become_peripheral() which is called from higher up in the
>>> USB stack.
>>>
>>> However, from the code, what is /meant/ to happen is that the "omap_otg"
>>> driver is meant to call omap_otg_probe() (which sets that field) before
>>> anything calls drivers/cbus/tahvo-usb.c/omap_otg_init(). However, due to
>>> the timing problem, it occurs out of sequence, so it thinks there isn't a
>>> transceiver present.
>>>
>>> tahvo-usb.c looks as though it needs sorting out somehow; it seems to
>>> consist of two seperate drivers rammed together, plus it has this timing
>>> issue. The tahvo-usb code itself suggests splitting the tahvo-usb driver
>>> into an "omap-otg.c" driver, though some thought will be needed to
>>> eliminate the timing issue properly.
>>>
>>
>> Hmm, a quick diff with $ git diff omap-2.6.28..master drivers/Makefile
>> shows that cbus order has changed in the Makefile, maybe that causes it?
>
> Oooh that'd be horrible! but reverting it doesn't appear fix anything.
>
> Anyway, the breaking changeset doesn't have that change in it... its  
> still the ones that I highlighted at the start of this thread.
>
> Doing
>
> git log -p  
> eba05254cb561dc27d5664503f91f7c21954e648..0595ee8a05836666b225e6bf003ede0da1e6e329  
> drivers/Makefile
>
> Doesn't show any ordering changes in Makefile affecting cbus or platform...
>
> Incidentally, I tried turning on CONFIG_BOOT_PRINTK_DELAY with a  
> boot_delay=100. With that, it now DOES probe the omap_otg device in  
> tahvo-usb first, but it dies with a NULL pointer dereference. Still  
> sounds like an initialisation timing problem here...

The attached (nasty!) debugging patch reveals that omap_otg_probe() is  
not actually being called at all! Only tahvo_usb_become_peripheral()  
is called.

If I comment out the:

#ifdef CONFIG_USB_OTG
         if (!tahvo_otg_dev) {
                 printk("tahvo-usb: no tahvo_otg_dev\n");
                 return -ENODEV;
         }
#endif

section, then it sees my USB device and attempts to boot over NFS. Of  
course, this isn't a proper solution :)

Comments

Andrew de Quincey May 23, 2009, 12:28 p.m. UTC | #1
Quoting Andrew de Quincey <adq@lidskialf.net>:

> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>
>> Quoting Tony Lindgren <tony@atomide.com>:
>>
>>> * Andrew de Quincey <adq@lidskialf.net> [090522 18:39]:
>>>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>>>
>>>>> Quoting Andrew de Quincey <adq@lidskialf.net>:
>>>>>
>>>>>> Quoting Andrew de Quincey <adq_dvb@lidskialf.net>:
>>>>>>
>>>>>>> Quoting Tony Lindgren <tony@atomide.com>:
>>>>>>>
>>>>>>>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090519 22:15]:
>>>>>>>>> Quoting Tony Lindgren <tony@atomide.com>:
>>>>>>>>>
>>>>>>>>>> * Andrew de Quincey <adq_dvb@lidskialf.net> [090516 19:17]:
>>>>>>>>>>> Argh, my N770 seems to have just died; it has been  
>>>>>>>>>>> behaving slightly
>>>>>>>>>>> oddly and now it simply won't turn on (black screen and no  
>>>>>>>>>>>  sign of life
>>>>>>>>>>> whatsoever).
>>>>>>>>>>>
>>>>>>>>>>> It is well out of warranty and frankly I don't see myself
>>>>>>>>>>> buying another
>>>>>>>>>>> one, so this effectively ends my hacking on it :(
>>>>>>>>>>
>>>>>>>>>> Bummer :(
>>>>>>>>>>
>>>>>>>>>> After a quick try, CONFIG_OMAP_RESET_CLOCKS was the first   
>>>>>>>>>> stopper, then
>>>>>>>>>> it could not mount the MMC root.
>>>>>>>>>
>>>>>>>>> Ahh excellent, that was why I posted my progress, in case it  
>>>>>>>>>  rang a bell
>>>>>>>>> with anyone! I think the touchpad driver may be broken as well BTW.
>>>>>>>>>
>>>>>>>>>> I think there was a patch posted for the omap1 MMC by
>>>>>>>>>> Ladislav few months
>>>>>>>>>> ago that probably fixes it.
>>>>>>>>>
>>>>>>>>> Cool - I hope I may be back in the running soon (I was rather annoyed
>>>>>>>>> when I posted that message!); I've ordered a new battery in case its
>>>>>>>>> just that. A kind person has also offered me one thats broken in a
>>>>>>>>> different way that I can probably cobble together with the remains of
>>>>>>>>> mine if its something more critical that has died.
>>>>>>>>
>>>>>>>> Good to hear, let's hope it just needs a new battery.
>>>>>>>>
>>>>>>>> See also the n8x0 thread. If we get drivers/cbus to mainline, we
>>>>>>>> pretty much have everything we need for 770 in mainline too.
>>>>>>>>
>>>>>>>> It would be nice to get the drivers/mmc/host/omap.c patch integrated
>>>>>>>> for 2.6.30 to make omap1 MMC work again. Ladislav, any news on that?
>>>>>>>
>>>>>>> OK! My friend has lent me his N770 in the meantime so I can get
>>>>>>> going again. It seems the board is fried on mine as my battery
>>>>>>> works perfectly fine in his. gah!
>>>>>>>
>>>>>>> Anyway, I have just tried disabling RESET_CLOCKS, but it still
>>>>>>> doesn't work for me with the very latest linux-omap-2.6.
>>>>>>>
>>>>>>> With my HWA patch applied, at least the screen goes black, but I
>>>>>>> don't see any console output, and the thing doesn't appear as a
>>>>>>> USB gadget (I'm mounting NFS as root over USB with cdc_ether).
>>>>>>>
>>>>>>> I wish the thing had an LED I could turn on! Hmm, I wonder if I
>>>>>>> could turn off the backlight easily..
>>>>>>
>>>>>> Actually, after playing a bit, I discovered I'm getting a boot
>>>>>> penguin logo ok, but no actual textual console output; weird!
>>>>>
>>>>> I feel really silly; the N770's bootloader had "serial-console"
>>>>> enabled, which meant all the kernel messages were being sent out that
>>>>> instead of being displayed on the fb. So I can now see WTF is going on!
>>>>>
>>>>> Next problem for me: ohci-hcd.c is reporting an initialisation error
>>>>> in the latest kernels, which is why my NFS-over-USB mount fails. I
>>>>> can't see any changes in the initialisation *values* used, but there
>>>>> have obviously been the "kill OMAP_TAG_USB" changes; I'm wondering if
>>>>> its some initialisation ordering problem.
>>>>
>>>> OK got it, it IS a timing problem, due to non-ARM changes in the core
>>>> kernel (possibly the recent async subsystem startup improvements?).
>>>>
>>>> In the middle of the boot with a recent kernel, I see a message
>>>> "tahvo-usb: no tahvo_otg_dev" coming from
>>>> drivers/cbus/tahvo-usb.c/omap_otg_init(). This is because the internal
>>>> field "tahvo_otg_dev" is NULL. In turn, omap_otg_init() is being called
>>>> by tahvo_usb_become_peripheral() which is called from higher up in the
>>>> USB stack.
>>>>
>>>> However, from the code, what is /meant/ to happen is that the "omap_otg"
>>>> driver is meant to call omap_otg_probe() (which sets that field) before
>>>> anything calls drivers/cbus/tahvo-usb.c/omap_otg_init(). However, due to
>>>> the timing problem, it occurs out of sequence, so it thinks there isn't a
>>>> transceiver present.
>>>>
>>>> tahvo-usb.c looks as though it needs sorting out somehow; it seems to
>>>> consist of two seperate drivers rammed together, plus it has this timing
>>>> issue. The tahvo-usb code itself suggests splitting the tahvo-usb driver
>>>> into an "omap-otg.c" driver, though some thought will be needed to
>>>> eliminate the timing issue properly.
>>>>
>>>
>>> Hmm, a quick diff with $ git diff omap-2.6.28..master drivers/Makefile
>>> shows that cbus order has changed in the Makefile, maybe that causes it?
>>
>> Oooh that'd be horrible! but reverting it doesn't appear fix anything.
>>
>> Anyway, the breaking changeset doesn't have that change in it...  
>> its  still the ones that I highlighted at the start of this thread.
>>
>> Doing
>>
>> git log -p   
>> eba05254cb561dc27d5664503f91f7c21954e648..0595ee8a05836666b225e6bf003ede0da1e6e329   
>> drivers/Makefile
>>
>> Doesn't show any ordering changes in Makefile affecting cbus or platform...
>>
>> Incidentally, I tried turning on CONFIG_BOOT_PRINTK_DELAY with a   
>> boot_delay=100. With that, it now DOES probe the omap_otg device in  
>>  tahvo-usb first, but it dies with a NULL pointer dereference.  
>> Still  sounds like an initialisation timing problem here...
>
> The attached (nasty!) debugging patch reveals that omap_otg_probe()  
> is  not actually being called at all! Only  
> tahvo_usb_become_peripheral()  is called.
>
> If I comment out the:
>
> #ifdef CONFIG_USB_OTG
>         if (!tahvo_otg_dev) {
>                 printk("tahvo-usb: no tahvo_otg_dev\n");
>                 return -ENODEV;
>         }
> #endif
>
> section, then it sees my USB device and attempts to boot over NFS.  
> Of  course, this isn't a proper solution :)
>


Found it!

It is this change here:  
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=57fee4a58fe802272742caae248872c392a60670

If I comment out the bit in platform.c with:
        if (pdrv->id_table)
                return platform_match_id(pdrv->id_table, pdev) != NULL;
Then all works fine (it drops back to using name comparison as prior  
to this change).

With it left in however, pdrv->id_table is non-NULL for the tahvo-usb  
driver, so it fails the check. I'm /guessing/ its filled with crap  
since we're not setting it to anything anywhere, but I don't know  
enough about the platform device driver model yet.

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren June 1, 2009, 11:18 p.m. UTC | #2
* Andrew de Quincey <adq_dvb@lidskialf.net> [090523 06:25]:

<snip snip>

> Ok, I spent some time looking for the magic code in  
> drivers/base/platform.c that would mean you could use a device  
> registered with register_platform_device() with a driver which had been 
> registered with just driver_register().
>
> As it turns out, there is no magic code:  it appears you must always use 
> register_platform_driver() for platform_devices (because the  
> drivers/base/platform.c code expects to be able to cast things  
> internally to a struct platform_driver, which is NOT the case when using 
> driver_register())
>
> Attached is v1 of a patch which converts everything in drivers/cbus to  
> use register_platform_driver(). This means the USB gadget stuff is now  
> working properly, but obviously this needs review!
>
> One problem though:  Juha Yrjölä's name is being corrupted in the file  
> headers. I'm using all-UTF8 here, but obviously the files are in a  
> different encoding. What one is the correct to use? I can easily convert 
> them to the appropriate UTF8 characters, but I don't want to piss people 
> off by just doing so.

Can you please repost the patch with proper Signed-off-by? And with
the subject that makes sense for commit.. That way I can apply it
cleanly using patchworks and no editing needed ;)

Tony


> diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c
> index 1ebc33b..76343f9 100644
> --- a/drivers/cbus/retu-rtc.c
> +++ b/drivers/cbus/retu-rtc.c
> @@ -361,7 +361,7 @@ static int retu_rtc_init_irq(void)
>  }
>  
>  
> -static int __devinit retu_rtc_probe(struct device *dev)
> +static int __devinit retu_rtc_probe(struct platform_device *pdev)
>  {
>  	int r;
>  
> @@ -380,48 +380,49 @@ static int __devinit retu_rtc_probe(struct device *dev)
>  	else
>  		retu_rtc_do_reset();
>  
> -	if ((r = device_create_file(dev, &dev_attr_time)) != 0)
> +	if ((r = device_create_file(&(pdev->dev), &dev_attr_time)) != 0)
>  		return r;
> -	else if ((r = device_create_file(dev, &dev_attr_reset)) != 0)
> +	else if ((r = device_create_file(&(pdev->dev), &dev_attr_reset)) != 0)
>  		goto err_unregister_time;
> -	else if ((r = device_create_file(dev, &dev_attr_alarm)) != 0)
> +	else if ((r = device_create_file(&(pdev->dev), &dev_attr_alarm)) != 0)
>  		goto err_unregister_reset;
> -	else if ((r = device_create_file(dev, &dev_attr_alarm_expired)) != 0)
> +	else if ((r = device_create_file(&(pdev->dev), &dev_attr_alarm_expired)) != 0)
>  		goto err_unregister_alarm;
> -	else if ((r = device_create_file(dev, &dev_attr_cal)) != 0)
> +	else if ((r = device_create_file(&(pdev->dev), &dev_attr_cal)) != 0)
>  		goto err_unregister_alarm_expired;
>  	else
>  		return r;
>  
>  err_unregister_alarm_expired:
> -	device_remove_file(dev, &dev_attr_alarm_expired);
> +	device_remove_file(&(pdev->dev), &dev_attr_alarm_expired);
>  err_unregister_alarm:
> -	device_remove_file(dev, &dev_attr_alarm);
> +	device_remove_file(&(pdev->dev), &dev_attr_alarm);
>  err_unregister_reset:
> -	device_remove_file(dev, &dev_attr_reset);
> +	device_remove_file(&(pdev->dev), &dev_attr_reset);
>  err_unregister_time:
> -	device_remove_file(dev, &dev_attr_time);
> +	device_remove_file(&(pdev->dev), &dev_attr_time);
>  	return r;
>  }
>  
> -static int __devexit retu_rtc_remove(struct device *dev)
> +static int __devexit retu_rtc_remove(struct platform_device *pdev)
>  {
>  	retu_disable_irq(RETU_INT_RTCS);
>  	retu_free_irq(RETU_INT_RTCS);
>  	retu_free_irq(RETU_INT_RTCA);
> -	device_remove_file(dev, &dev_attr_cal);
> -	device_remove_file(dev, &dev_attr_alarm_expired);
> -	device_remove_file(dev, &dev_attr_alarm);
> -	device_remove_file(dev, &dev_attr_reset);
> -	device_remove_file(dev, &dev_attr_time);
> +	device_remove_file(&(pdev->dev), &dev_attr_cal);
> +	device_remove_file(&(pdev->dev), &dev_attr_alarm_expired);
> +	device_remove_file(&(pdev->dev), &dev_attr_alarm);
> +	device_remove_file(&(pdev->dev), &dev_attr_reset);
> +	device_remove_file(&(pdev->dev), &dev_attr_time);
>  	return 0;
>  }
>  
> -static struct device_driver retu_rtc_driver = {
> -	.name		= "retu-rtc",
> -	.bus		= &platform_bus_type,
> +static struct platform_driver retu_rtc_driver = {
>  	.probe		= retu_rtc_probe,
>  	.remove		= __devexit_p(retu_rtc_remove),
> +	.driver		= {
> +		.name		= "retu-rtc",
> +	}
>  };
>  
>  static struct platform_device retu_rtc_device = {
> @@ -448,7 +449,7 @@ static int __init retu_rtc_init(void)
>  
>  	init_completion(&retu_rtc_exited);
>  
> -	if ((ret = driver_register(&retu_rtc_driver)) != 0)
> +	if ((ret = platform_driver_register(&retu_rtc_driver)) != 0)
>  		return ret;
>  
>  	if ((ret = platform_device_register(&retu_rtc_device)) != 0)
> @@ -457,14 +458,14 @@ static int __init retu_rtc_init(void)
>  	return 0;
>  
>  err_unregister_driver:
> -	driver_unregister(&retu_rtc_driver);
> +	platform_driver_unregister(&retu_rtc_driver);
>  	return ret;
>  }
>  
>  static void __exit retu_rtc_exit(void)
>  {
>  	platform_device_unregister(&retu_rtc_device);
> -	driver_unregister(&retu_rtc_driver);
> +	platform_driver_unregister(&retu_rtc_driver);
>  
>  	wait_for_completion(&retu_rtc_exited);
>  }
> diff --git a/drivers/cbus/retu-wdt.c b/drivers/cbus/retu-wdt.c
> index b7b20b7..1fa181e 100644
> --- a/drivers/cbus/retu-wdt.c
> +++ b/drivers/cbus/retu-wdt.c
> @@ -104,20 +104,20 @@ static DEVICE_ATTR(period, S_IRUGO | S_IWUSR, retu_wdt_period_show, \
>  			retu_wdt_period_store);
>  static DEVICE_ATTR(counter, S_IRUGO, retu_wdt_counter_show, NULL);
>  
> -static int __devinit retu_wdt_probe(struct device *dev)
> +static int __devinit retu_wdt_probe(struct platform_device *pdev)
>  {
>  	int ret;
>  
> -	ret = device_create_file(dev, &dev_attr_period);
> +	ret = device_create_file(&(pdev->dev), &dev_attr_period);
>  	if (ret) {
>  		printk(KERN_ERR "retu_wdt_probe: Error creating "
>  					"sys device file: period\n");
>  		return ret;
>  	}
>  
> -	ret = device_create_file(dev, &dev_attr_counter);
> +	ret = device_create_file(&(pdev->dev), &dev_attr_counter);
>  	if (ret) {
> -		device_remove_file(dev, &dev_attr_period);
> +		device_remove_file(&(pdev->dev), &dev_attr_period);
>  		printk(KERN_ERR "retu_wdt_probe: Error creating "
>  					"sys device file: counter\n");
>  	}
> @@ -125,10 +125,10 @@ static int __devinit retu_wdt_probe(struct device *dev)
>  	return ret;
>  }
>  
> -static int __devexit retu_wdt_remove(struct device *dev)
> +static int __devexit retu_wdt_remove(struct platform_device *pdev)
>  {
> -	device_remove_file(dev, &dev_attr_period);
> -	device_remove_file(dev, &dev_attr_counter);
> +	device_remove_file(&(pdev->dev), &dev_attr_period);
> +	device_remove_file(&(pdev->dev), &dev_attr_counter);
>  	return 0;
>  }
>  
> @@ -145,11 +145,12 @@ static struct platform_device retu_wdt_device = {
>  	},
>  };
>  
> -static struct device_driver retu_wdt_driver = {
> -	.name = "retu-watchdog",
> -	.bus = &platform_bus_type,
> +static struct platform_driver retu_wdt_driver = {
>  	.probe = retu_wdt_probe,
>  	.remove = __devexit_p(retu_wdt_remove),
> +	.driver = {
> +		.name = "retu-watchdog",
> +	}
>  };
>  
>  static int __init retu_wdt_init(void)
> @@ -158,7 +159,7 @@ static int __init retu_wdt_init(void)
>  
>  	init_completion(&retu_wdt_completion);
>  
> -	ret = driver_register(&retu_wdt_driver);
> +	ret = platform_driver_register(&retu_wdt_driver);
>  	if (ret)
>  		return ret;
>  
> @@ -178,7 +179,7 @@ static int __init retu_wdt_init(void)
>  	return ret;
>  
>  exit1:
> -	driver_unregister(&retu_wdt_driver);
> +	platform_driver_unregister(&retu_wdt_driver);
>  	wait_for_completion(&retu_wdt_completion);
>  
>  	return ret;
> @@ -187,7 +188,7 @@ exit1:
>  static void __exit retu_wdt_exit(void)
>  {
>  	platform_device_unregister(&retu_wdt_device);
> -	driver_unregister(&retu_wdt_driver);
> +	platform_driver_unregister(&retu_wdt_driver);
>  
>  	wait_for_completion(&retu_wdt_completion);
>  }
> diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
> index 84d7840..d9f28d5 100644
> --- a/drivers/cbus/retu.c
> +++ b/drivers/cbus/retu.c
> @@ -5,7 +5,7 @@
>   *
>   * Copyright (C) 2004, 2005 Nokia Corporation
>   *
> - * Written by Juha Yrj?l? <juha.yrjola@nokia.com>,
> + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
>   *	      David Weinehall <david.weinehall@nokia.com>, and
>   *	      Mikko Ylinen <mikko.k.ylinen@nokia.com>
>   *
> @@ -319,7 +319,7 @@ static void retu_power_off(void)
>   * Probe for the Retu ASIC and allocate memory
>   * for its device-struct if found
>   */
> -static int __devinit retu_probe(struct device *dev)
> +static int __devinit retu_probe(struct platform_device *pdev)
>  {
>  	const struct omap_em_asic_bb5_config * em_asic_config;
>  	int rev, ret;
> @@ -384,7 +384,7 @@ static int __devinit retu_probe(struct device *dev)
>  	return 0;
>  }
>  
> -static int retu_remove(struct device *dev)
> +static int retu_remove(struct platform_device *pdev)
>  {
>  #ifdef CONFIG_CBUS_RETU_USER
>  	retu_user_cleanup();
> @@ -403,11 +403,12 @@ static void retu_device_release(struct device *dev)
>  	complete(&device_release);
>  }
>  
> -static struct device_driver retu_driver = {
> -	.name		= "retu",
> -	.bus		= &platform_bus_type,
> +static struct platform_driver retu_driver = {
>  	.probe		= retu_probe,
>  	.remove		= retu_remove,
> +	.driver 	= {
> +		.name		= "retu",
> +	}
>  };
>  
>  static struct platform_device retu_device = {
> @@ -431,11 +432,11 @@ static int __init retu_init(void)
>  
>  	init_completion(&device_release);
>  
> -	if ((ret = driver_register(&retu_driver)) < 0)
> +	if ((ret = platform_driver_register(&retu_driver)) < 0)
>  		return ret;
>  
>  	if ((ret = platform_device_register(&retu_device)) < 0) {
> -		driver_unregister(&retu_driver);
> +		platform_driver_unregister(&retu_driver);
>  		return ret;
>  	}
>  	return 0;
> @@ -447,7 +448,7 @@ static int __init retu_init(void)
>  static void __exit retu_exit(void)
>  {
>  	platform_device_unregister(&retu_device);
> -	driver_unregister(&retu_driver);
> +	platform_driver_unregister(&retu_driver);
>  	wait_for_completion(&device_release);
>  }
>  
> @@ -464,4 +465,4 @@ module_exit(retu_exit);
>  
>  MODULE_DESCRIPTION("Retu ASIC control");
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Juha Yrj?l?, David Weinehall, and Mikko Ylinen");
> +MODULE_AUTHOR("Juha Yrj�l�, David Weinehall, and Mikko Ylinen");
> diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
> index d8ad836..df74d28 100644
> --- a/drivers/cbus/tahvo-usb.c
> +++ b/drivers/cbus/tahvo-usb.c
> @@ -9,9 +9,9 @@
>   * Copyright (C) 2004 Texas Instruments
>   * Copyright (C) 2004 David Brownell
>   *
> - * Written by Juha Yrj?l? <juha.yrjola@nokia.com>,
> + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
>   *	      Tony Lindgren <tony@atomide.com>, and
> - *	      Timo Ter?s <timo.teras@nokia.com>
> + *	      Timo Ter�s <timo.teras@nokia.com>
>   *
>   * This file is subject to the terms and conditions of the GNU General
>   * Public License. See the file "COPYING" in the main directory of this
> @@ -186,11 +186,11 @@ static int omap_otg_init(void)
>  	return 0;
>  }
>  
> -static int omap_otg_probe(struct device *dev)
> +static int omap_otg_probe(struct platform_device *pdev)
>  {
>  	int ret;
>  
> -	tahvo_otg_dev = to_platform_device(dev);
> +	tahvo_otg_dev = pdev;
>  	ret = omap_otg_init();
>  	if (ret != 0) {
>  		printk(KERN_ERR "tahvo-usb: omap_otg_init failed\n");
> @@ -202,19 +202,21 @@ static int omap_otg_probe(struct device *dev)
>  			   &tahvo_usb_device);
>  }
>  
> -static int omap_otg_remove(struct device *dev)
> +static int omap_otg_remove(struct platform_device *pdev)
>  {
> -	free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
> +	if (tahvo_otg_dev != NULL)
> +		free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
>  	tahvo_otg_dev = NULL;
>  
>  	return 0;
>  }
>  
> -struct device_driver omap_otg_driver = {
> -	.name		= "omap_otg",
> -	.bus		= &platform_bus_type,
> +struct platform_driver omap_otg_driver = {
>  	.probe		= omap_otg_probe,
>  	.remove		= omap_otg_remove,
> +	.driver		= {
> +		.name		= "omap_otg",
> +	}
>  };
>  
>  /*
> @@ -641,19 +643,19 @@ static ssize_t otg_mode_store(struct device *device,
>  static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
>  #endif
>  
> -static int tahvo_usb_probe(struct device *dev)
> +static int tahvo_usb_probe(struct platform_device *pdev)
>  {
>  	struct tahvo_usb *tu;
>  	int ret;
>  
> -	dev_dbg(dev, "probe\n");
> +	dev_dbg(&(pdev->dev), "probe\n");
>  
>  	/* Create driver data */
>  	tu = kmalloc(sizeof(*tu), GFP_KERNEL);
>  	if (!tu)
>  		return -ENOMEM;
>  	memset(tu, 0, sizeof(*tu));
> -	tu->pt_dev = container_of(dev, struct platform_device, dev);
> +	tu->pt_dev = pdev;
>  #ifdef CONFIG_USB_OTG
>  	/* Default mode */
>  #ifdef CONFIG_CBUS_TAHVO_USB_HOST_BY_DEFAULT
> @@ -680,9 +682,9 @@ static int tahvo_usb_probe(struct device *dev)
>  	}
>  
>  	/* Attributes */
> -	ret = device_create_file(dev, &dev_attr_vbus_state);
> +	ret = device_create_file(&(pdev->dev), &dev_attr_vbus_state);
>  #ifdef CONFIG_USB_OTG
> -	ret |= device_create_file(dev, &dev_attr_otg_mode);
> +	ret |= device_create_file(&(pdev->dev), &dev_attr_otg_mode);
>  #endif
>  	if (ret)
>  		printk(KERN_ERR "attribute creation failed: %d\n", ret);
> @@ -706,7 +708,7 @@ static int tahvo_usb_probe(struct device *dev)
>  		return ret;
>  	}
>  
> -	dev->driver_data = tu;
> +	pdev->dev.driver_data = tu;
>  
>  	/* Act upon current vbus state once at startup. A vbus state irq may or
>  	 * may not be generated in addition to this. */
> @@ -714,25 +716,26 @@ static int tahvo_usb_probe(struct device *dev)
>  	return 0;
>  }
>  
> -static int tahvo_usb_remove(struct device *dev)
> +static int tahvo_usb_remove(struct platform_device *pdev)
>  {
> -	dev_dbg(dev, "remove\n");
> +	dev_dbg(&(pdev->dev), "remove\n");
>  
>  	tahvo_free_irq(TAHVO_INT_VBUSON);
>  	flush_scheduled_work();
>  	otg_set_transceiver(0);
> -	device_remove_file(dev, &dev_attr_vbus_state);
> +	device_remove_file(&(pdev->dev), &dev_attr_vbus_state);
>  #ifdef CONFIG_USB_OTG
> -	device_remove_file(dev, &dev_attr_otg_mode);
> +	device_remove_file(&(pdev->dev), &dev_attr_otg_mode);
>  #endif
>  	return 0;
>  }
>  
> -static struct device_driver tahvo_usb_driver = {
> -	.name		= "tahvo-usb",
> -	.bus		= &platform_bus_type,
> +static struct platform_driver tahvo_usb_driver = {
>  	.probe		= tahvo_usb_probe,
>  	.remove		= tahvo_usb_remove,
> +	.driver		= {
> +		.name		= "tahvo-usb",
> +	}
>  };
>  
>  static struct platform_device tahvo_usb_device = {
> @@ -745,18 +748,18 @@ static int __init tahvo_usb_init(void)
>  	int ret = 0;
>  
>  	printk(KERN_INFO "Tahvo USB transceiver driver initializing\n");
> -	ret = driver_register(&tahvo_usb_driver);
> +	ret = platform_driver_register(&tahvo_usb_driver);
>  	if (ret)
>  		return ret;
>  	ret = platform_device_register(&tahvo_usb_device);
>  	if (ret < 0) {
> -		driver_unregister(&tahvo_usb_driver);
> +		platform_driver_unregister(&tahvo_usb_driver);
>  		return ret;
>  	}
> -	ret = driver_register(&omap_otg_driver);
> +	ret = platform_driver_register(&omap_otg_driver);
>  	if (ret) {
>  		platform_device_unregister(&tahvo_usb_device);
> -		driver_unregister(&tahvo_usb_driver);
> +		platform_driver_unregister(&tahvo_usb_driver);
>  		return ret;
>  	}
>  	return 0;
> @@ -766,12 +769,12 @@ subsys_initcall(tahvo_usb_init);
>  
>  static void __exit tahvo_usb_exit(void)
>  {
> -	driver_unregister(&omap_otg_driver);
> +	platform_driver_unregister(&omap_otg_driver);
>  	platform_device_unregister(&tahvo_usb_device);
> -	driver_unregister(&tahvo_usb_driver);
> +	platform_driver_unregister(&tahvo_usb_driver);
>  }
>  module_exit(tahvo_usb_exit);
>  
>  MODULE_DESCRIPTION("Tahvo USB OTG Transceiver Driver");
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Juha Yrj?l?, Tony Lindgren, and Timo Ter?s");
> +MODULE_AUTHOR("Juha Yrj�l�, Tony Lindgren, and Timo Ter�s");
> diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
> index e734c4c..29fd4b8 100644
> --- a/drivers/cbus/tahvo.c
> +++ b/drivers/cbus/tahvo.c
> @@ -5,7 +5,7 @@
>   *
>   * Copyright (C) 2004, 2005 Nokia Corporation
>   *
> - * Written by Juha Yrj?l? <juha.yrjola@nokia.com>,
> + * Written by Juha Yrj�l� <juha.yrjola@nokia.com>,
>   *	      David Weinehall <david.weinehall@nokia.com>, and
>   *	      Mikko Ylinen <mikko.k.ylinen@nokia.com>
>   *
> @@ -287,7 +287,7 @@ void tahvo_free_irq(int id)
>   * Probe for the Tahvo ASIC and allocate memory
>   * for its device-struct if found
>   */
> -static int __devinit tahvo_probe(struct device *dev)
> +static int __devinit tahvo_probe(struct platform_device *pdev)
>  {
>  	const struct omap_em_asic_bb5_config * em_asic_config;
>  	int rev, id, ret;
> @@ -356,7 +356,7 @@ static int __devinit tahvo_probe(struct device *dev)
>  	return 0;
>  }
>  
> -static int tahvo_remove(struct device *dev)
> +static int tahvo_remove(struct platform_device *pdev)
>  {
>  #ifdef CONFIG_CBUS_TAHVO_USER
>  	tahvo_user_cleanup();
> @@ -375,11 +375,12 @@ static void tahvo_device_release(struct device *dev)
>  	complete(&device_release);
>  }
>  
> -static struct device_driver tahvo_driver = {
> -	.name		= "tahvo",
> -	.bus		= &platform_bus_type,
> +static struct platform_driver tahvo_driver = {
>  	.probe		= tahvo_probe,
>  	.remove		= tahvo_remove,
> +	.driver		= {
> +		.name		= "tahvo",
> +	}
>  };
>  
>  static struct platform_device tahvo_device = {
> @@ -403,11 +404,11 @@ static int __init tahvo_init(void)
>  
>  	init_completion(&device_release);
>  
> -	if ((ret = driver_register(&tahvo_driver)) < 0)
> +	if ((ret = platform_driver_register(&tahvo_driver)) < 0)
>  		return ret;
>  
>  	if ((ret = platform_device_register(&tahvo_device)) < 0) {
> -		driver_unregister(&tahvo_driver);
> +		platform_driver_unregister(&tahvo_driver);
>  		return ret;
>  	}
>  	return 0;
> @@ -419,7 +420,7 @@ static int __init tahvo_init(void)
>  static void __exit tahvo_exit(void)
>  {
>  	platform_device_unregister(&tahvo_device);
> -	driver_unregister(&tahvo_driver);
> +	platform_driver_unregister(&tahvo_driver);
>  	wait_for_completion(&device_release);
>  }
>  
> @@ -439,4 +440,4 @@ module_exit(tahvo_exit);
>  
>  MODULE_DESCRIPTION("Tahvo ASIC control");
>  MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Juha Yrj?l?, David Weinehall, and Mikko Ylinen");
> +MODULE_AUTHOR("Juha Yrj�l�, David Weinehall, and Mikko Ylinen");
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew de Quincey June 8, 2009, 7:55 p.m. UTC | #3
Recent changes in the drivers/base/platform.c exposed an inconsistency  
in the cbus drivers; they weren't matching platform_divers with  
platform_devices, which causes all sorts of structure casting issues  
within the base platform code since it assumes this.

Signed-off-by: Andrew de Quincey <adq@lidskialf.net>


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren June 9, 2009, 10:20 a.m. UTC | #4
* Andrew de Quincey <adq_dvb@lidskialf.net> [090608 12:56]:
> Recent changes in the drivers/base/platform.c exposed an inconsistency  
> in the cbus drivers; they weren't matching platform_divers with  
> platform_devices, which causes all sorts of structure casting issues  
> within the base platform code since it assumes this.
>
> Signed-off-by: Andrew de Quincey <adq@lidskialf.net>

The patch seems to be missing from the mail?

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index d8ad836..2835075 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -150,6 +150,8 @@  static int omap_otg_init(void)
 {
 	u32 l;
 
+	printk("======================================== INIT\n");
+
 #ifdef CONFIG_USB_OTG
 	if (!tahvo_otg_dev) {
 		printk("tahvo-usb: no tahvo_otg_dev\n");
@@ -190,6 +192,8 @@  static int omap_otg_probe(struct device *dev)
 {
 	int ret;
 
+	printk("+++++++++++++++++++++++++++++++++++++++++ PROBE\n");
+
 	tahvo_otg_dev = to_platform_device(dev);
 	ret = omap_otg_init();
 	if (ret != 0) {
@@ -334,6 +338,9 @@  static void tahvo_usb_become_host(struct tahvo_usb *tu)
 {
 	u32 l;
 
+	printk("+++++++++++++++++++++++++++++++++++++++++ HOST\n");
+
+
 	/* Clear system and transceiver controlled bits
 	 * also mark the A-session is always valid */
 	omap_otg_init();
@@ -361,6 +368,9 @@  static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
 {
 	u32 l;
 
+	printk("+++++++++++++++++++++++++++++++++++++++++ PERIPHERAL\n");
+
+
 	/* Clear system and transceiver controlled bits
 	 * and enable ID to mark peripheral mode and
 	 * BSESSEND to mark no Vbus */