Re: isp1362-hcd doesn't build on ARM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Mike Frysinger writes:
> On Monday 11 January 2010 12:24:58 Lothar Waßmann wrote:
> > -	dev_info(hcd->self.controller, "  INTL: %4d * (%3lu+8):  %4d @ $%04x\n",
> > +	dev_info(hcd->self.controller, "  INTL: %4d * (%3u+8):  %4d @ $%04x\n",
> >  		 ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE,
> >  		 intl_size, istl_size);
> > -	dev_info(hcd->self.controller, "  ATL : %4d * (%3lu+8):  %4d @ $%04x\n",
> > +	dev_info(hcd->self.controller, "  ATL : %4d * (%3u+8):  %4d @ $%04x\n",
> >  		 atl_buffers, atl_blksize - PTD_HEADER_SIZE,
> >  		 atl_size, istl_size + intl_size);
> 
> this merely shifts the warning around from some people to others, as my change 
> from %u to %lu did.  i'm pretty sure we want to use %zu here and not %lu or 
> %u.  there has been other posts on the list about this.
> 
Ok.

> > @@ -2711,6 +2711,8 @@
> >  	void __iomem *data_reg;
> >  	int irq;
> >  	int retval = 0;
> > +	struct resource *irq_res;
> > +	unsigned int irq_flags = 0;
> > 
> >  	/* basic sanity checks first.  board-specific init logic should
> >  	 * have initialized this the three resources and probably board
> > @@ -2724,11 +2726,12 @@
> > 
> >  	data = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >  	addr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> > -	irq = platform_get_irq(pdev, 0);
> > -	if (!addr || !data || irq < 0) {
> > +	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > +	if (!addr || !data || irq_res) {
> >  		retval = -ENODEV;
> >  		goto err1;
> >  	}
> > +	irq = irq_res->start;
> 
> what's wrong with the existing platform_get_irq() ?  common code already 
> returns an error (-ENXIO) if the IRQ resource doesnt exist.
> 
> or did you just forget to initialize irq_flags here ?  the new code sets 
> irq_flags to 0 and nothing else ...
>
Right. The following is what I intended to do:
--- a/drivers/usb/host/isp1362-hcd.c	2009-12-03 04:51:21.000000000 +0100
+++ b/drivers/usb/host/isp1362-hcd.c	2010-01-12 08:37:50.000000000 +0100
@@ -2284,10 +2284,10 @@
 	dev_info(hcd->self.controller, "ISP1362 Memory usage:\n");
 	dev_info(hcd->self.controller, "  ISTL:    2 * %4d:     %4d @ $%04x:$%04x\n",
 		 istl_size / 2, istl_size, 0, istl_size / 2);
-	dev_info(hcd->self.controller, "  INTL: %4d * (%3lu+8):  %4d @ $%04x\n",
+	dev_info(hcd->self.controller, "  INTL: %4d * (%3zu+8):  %4d @ $%04x\n",
 		 ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE,
 		 intl_size, istl_size);
-	dev_info(hcd->self.controller, "  ATL : %4d * (%3lu+8):  %4d @ $%04x\n",
+	dev_info(hcd->self.controller, "  ATL : %4d * (%3zu+8):  %4d @ $%04x\n",
 		 atl_buffers, atl_blksize - PTD_HEADER_SIZE,
 		 atl_size, istl_size + intl_size);
 	dev_info(hcd->self.controller, "  USED/FREE:   %4d      %4d\n", total,
@@ -2711,6 +2711,8 @@
 	void __iomem *data_reg;
 	int irq;
 	int retval = 0;
+	struct resource *irq_res;
+	unsigned int irq_flags = 0;
 
 	/* basic sanity checks first.  board-specific init logic should
 	 * have initialized this the three resources and probably board
@@ -2724,11 +2726,12 @@
 
 	data = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	addr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	irq = platform_get_irq(pdev, 0);
-	if (!addr || !data || irq < 0) {
+	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!addr || !data || !irq_res) {
 		retval = -ENODEV;
 		goto err1;
 	}
+	irq = irq_res->start;
 
 #ifdef CONFIG_USB_HCD_DMA
 	if (pdev->dev.dma_mask) {
@@ -2795,12 +2798,20 @@
 	}
 #endif
 
-#ifdef CONFIG_ARM
-	if (isp1362_hcd->board)
-		set_irq_type(irq, isp1362_hcd->board->int_act_high ? IRQT_RISING : IRQT_FALLING);
-#endif
+	if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE) {
+		irq_flags |= IRQF_TRIGGER_RISING;
+	}
+	if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE) {
+		irq_flags |= IRQF_TRIGGER_FALLING;
+	}
+	if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL) {
+		irq_flags |= IRQF_TRIGGER_HIGH;
+	}
+	if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL) {
+		irq_flags |= IRQF_TRIGGER_LOW;
+	}
 
-	retval = usb_add_hcd(hcd, irq, IRQF_TRIGGER_LOW | IRQF_DISABLED | IRQF_SHARED);
+	retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_DISABLED | IRQF_SHARED);
 	if (retval != 0)
 		goto err6;
 	pr_info("%s, irq %d\n", hcd->product_desc, irq);




Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@xxxxxxxxxxxxxxxxxxx
___________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux