Thread (32 messages) 32 messages, 5 authors, 2012-04-19

[PATCH v2 1/8] ohci-nxp: Driver cleanup

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-04-17 20:36:55
Also in: linux-input, lkml

On Tuesday 17 April 2012, Roland Stigge wrote:
Cleanup for ohci-nxp.c:

* Cleanup of resource handling (mem and irq), use devm_request_and_ioremap()
* Fixed controller initialization (bits)
* Use DMA_BIT_MASK()
* Don't remove __devinit
* Removed obsolete gpio.h include
* More consistent bit access symbols
* Removed unused extern declaration ocpi_enable()
* Added error handling on i2c_get_adapter()
* Better USB host and device differentiation, since on LPC32xx, the same
 controller can be used as USB device controller
* Whitespace cleanup

Signed-off-by: Roland Stigge <redacted>
Looks almost good, I just found one more bug that you introduce:
+
+       hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
+       if (!hcd->regs) {
+               err("Failed to devm_request_and_ioremap");
                ret =  -ENOMEM;
                goto out4;
        }
-       hcd->regs = (void __iomem *)pdev->resource[0].start;
+       hcd->rsrc_start = (u64)(u32)hcd->regs;
+       hcd->rsrc_len = resource_size(res);
This is wrong in multiple ways:

* rsrc_start is a physical address, not an __iomem token.
* you cannot cast a pointer to u32 in general, only to unsigned long.

The fact that you need an ugly type cast like above could have told
you that you are doing something wrong here. I guess it should
be

	hcd->rsrc_start = res->start;

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help