};
struct isp1760_hcd {
+ struct usb_hcd *hcd;
+
u32 hcs_params;
spinlock_t lock;
struct slotinfo atl_slots[32];
static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd)
{
- return (struct isp1760_hcd *) (hcd->hcd_priv);
+ return *(struct isp1760_hcd **)hcd->hcd_priv;
}
/* Section 2.2 Host Controller Capability Registers */
static const struct hc_driver isp1760_hc_driver = {
.description = "isp1760-hcd",
.product_desc = "NXP ISP1760 USB Host Controller",
- .hcd_priv_size = sizeof(struct isp1760_hcd),
+ .hcd_priv_size = sizeof(struct isp1760_hcd *),
.irq = isp1760_irq,
.flags = HCD_MEMORY | HCD_USB2,
.reset = isp1760_hc_setup,
int isp1760_register(struct resource *mem, int irq, unsigned long irqflags,
struct device *dev, unsigned int devflags)
{
- struct usb_hcd *hcd;
+ struct usb_hcd *hcd = NULL;
struct isp1760_hcd *priv;
int ret;
if (usb_disabled())
return -ENODEV;
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
/* prevent usb-core allocating DMA pages */
dev->dma_mask = NULL;
if (!hcd)
return -ENOMEM;
- priv = hcd_to_priv(hcd);
+ priv->hcd = hcd;
+ *(struct isp1760_hcd **)hcd->hcd_priv = priv;
+
priv->devflags = devflags;
priv->rst_gpio = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH);
goto error;
device_wakeup_enable(hcd->self.controller);
- dev_set_drvdata(dev, hcd);
+ dev_set_drvdata(dev, priv);
return 0;
void isp1760_unregister(struct device *dev)
{
- struct usb_hcd *hcd = dev_get_drvdata(dev);
+ struct isp1760_hcd *priv = dev_get_drvdata(dev);
+ struct usb_hcd *hcd = priv->hcd;
usb_remove_hcd(hcd);
usb_put_hcd(hcd);