if (pdev->num_resources < 3) return -ENODEV;  addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); data = platform_get_resource(pdev, IORESOURCE_MEM, 1); 
sl811h_probe(struct device *dev){	struct usb_hcd		*hcd;	struct sl811		*sl811;	struct platform_device	*pdev;	struct resource		*addr, *data;	int			irq;	void __iomem		*addr_reg;	void __iomem		*data_reg;	int			retval;	u8			tmp;	/* basic sanity checks first.  board-specific init logic should	 * have initialized these three resources and probably board	 * specific platform_data.  we don't probe for IRQs, and do only	 * minimal sanity checking.	 */	pdev = container_of(dev, struct platform_device, dev);	if (pdev->num_resources < 3)		return -ENODEV;	addr = platform_get_resource(pdev, IORESOURCE_MEM, 0);	data = platform_get_resource(pdev, IORESOURCE_MEM, 1);	irq = platform_get_irq(pdev, 0);	if (!addr || !data || irq < 0)		return -ENODEV;	/* refuse to confuse usbcore */	if (dev->dma_mask) {		DBG("no we won't dma\n");		return -EINVAL;	}	if (!request_mem_region(addr->start, 1, hcd_name)) {		retval = -EBUSY;		goto err1;	}	addr_reg = ioremap(addr->start, resource_len(addr));	if (addr_reg == NULL) {		retval = -ENOMEM;		goto err2;	}	if (!request_mem_region(data->start, 1, hcd_name)) {		retval = -EBUSY;		goto err3;	}	data_reg = ioremap(data->start, resource_len(addr));	if (data_reg == NULL) {		retval = -ENOMEM;		goto err4;	}	/* allocate and initialize hcd */	hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id);	if (!hcd) {		retval = -ENOMEM;		goto err5;	}	hcd->rsrc_start = addr->start;	sl811 = hcd_to_sl811(hcd);	spin_lock_init(&sl811->lock);	INIT_LIST_HEAD(&sl811->async);	sl811->board = dev->platform_data;	init_timer(&sl811->timer);	sl811->timer.function = sl811h_timer;	sl811->timer.data = (unsigned long) sl811;	sl811->addr_reg = addr_reg;	sl811->data_reg = data_reg;	spin_lock_irq(&sl811->lock);	port_power(sl811, 0);	spin_unlock_irq(&sl811->lock);	msleep(200);	tmp = sl811_read(sl811, SL11H_HWREVREG);	switch (tmp >> 4) {	case 1:		hcd->product_desc = "SL811HS v1.2";		break;	case 2:		hcd->product_desc = "SL811HS v1.5";		break;	default:		/* reject case 0, SL11S is less functional */		DBG("chiprev %02x\n", tmp);		retval = -ENXIO;		goto err6;	}	/* sl811s would need a different handler for this irq */#ifdef	CONFIG_ARM	/* Cypress docs say the IRQ is IRQT_HIGH ... */	set_irq_type(irq, IRQT_RISING);#endif	retval = usb_add_hcd(hcd, irq, SA_INTERRUPT);	if (retval != 0)		goto err6;	create_debug_file(sl811);	return retval; err6:	usb_put_hcd(hcd); err5:	iounmap(data_reg); err4:	release_mem_region(data->start, 1); err3:	iounmap(addr_reg); err2:	release_mem_region(addr->start, 1); err1:	DBG("init error, %d\n", retval);	return retval;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1e9a47b62f7daf5a94fdd74a94dd4e076f44909a/sl811-hcd.c/buggy/drivers/usb/host/sl811-hcd.c