aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/uss720.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/uss720.c')
-rw-r--r--drivers/usb/misc/uss720.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 8b1d94a76914..29cad9e0a7a9 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -85,9 +85,9 @@ static void destroy_priv(struct kref *kref)
85{ 85{
86 struct parport_uss720_private *priv = container_of(kref, struct parport_uss720_private, ref_count); 86 struct parport_uss720_private *priv = container_of(kref, struct parport_uss720_private, ref_count);
87 87
88 dev_dbg(&priv->usbdev->dev, "destroying priv datastructure\n");
88 usb_put_dev(priv->usbdev); 89 usb_put_dev(priv->usbdev);
89 kfree(priv); 90 kfree(priv);
90 dbg("destroying priv datastructure");
91} 91}
92 92
93static void destroy_async(struct kref *kref) 93static void destroy_async(struct kref *kref)
@@ -118,14 +118,17 @@ static void async_complete(struct urb *urb)
118 priv = rq->priv; 118 priv = rq->priv;
119 pp = priv->pp; 119 pp = priv->pp;
120 if (status) { 120 if (status) {
121 err("async_complete: urb error %d", status); 121 dev_err(&urb->dev->dev, "async_complete: urb error %d\n",
122 status);
122 } else if (rq->dr.bRequest == 3) { 123 } else if (rq->dr.bRequest == 3) {
123 memcpy(priv->reg, rq->reg, sizeof(priv->reg)); 124 memcpy(priv->reg, rq->reg, sizeof(priv->reg));
124#if 0 125#if 0
125 dbg("async_complete regs %02x %02x %02x %02x %02x %02x %02x", 126 dev_dbg(&priv->usbdev->dev,
126 (unsigned int)priv->reg[0], (unsigned int)priv->reg[1], (unsigned int)priv->reg[2], 127 "async_complete regs %02x %02x %02x %02x %02x %02x %02x\n",
127 (unsigned int)priv->reg[3], (unsigned int)priv->reg[4], (unsigned int)priv->reg[5], 128 (unsigned int)priv->reg[0], (unsigned int)priv->reg[1],
128 (unsigned int)priv->reg[6]); 129 (unsigned int)priv->reg[2], (unsigned int)priv->reg[3],
130 (unsigned int)priv->reg[4], (unsigned int)priv->reg[5],
131 (unsigned int)priv->reg[6]);
129#endif 132#endif
130 /* if nAck interrupts are enabled and we have an interrupt, call the interrupt procedure */ 133 /* if nAck interrupts are enabled and we have an interrupt, call the interrupt procedure */
131 if (rq->reg[2] & rq->reg[1] & 0x10 && pp) 134 if (rq->reg[2] & rq->reg[1] & 0x10 && pp)
@@ -151,7 +154,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
151 return NULL; 154 return NULL;
152 rq = kmalloc(sizeof(struct uss720_async_request), mem_flags); 155 rq = kmalloc(sizeof(struct uss720_async_request), mem_flags);
153 if (!rq) { 156 if (!rq) {
154 err("submit_async_request out of memory"); 157 dev_err(&usbdev->dev, "submit_async_request out of memory\n");
155 return NULL; 158 return NULL;
156 } 159 }
157 kref_init(&rq->ref_count); 160 kref_init(&rq->ref_count);
@@ -162,7 +165,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
162 rq->urb = usb_alloc_urb(0, mem_flags); 165 rq->urb = usb_alloc_urb(0, mem_flags);
163 if (!rq->urb) { 166 if (!rq->urb) {
164 kref_put(&rq->ref_count, destroy_async); 167 kref_put(&rq->ref_count, destroy_async);
165 err("submit_async_request out of memory"); 168 dev_err(&usbdev->dev, "submit_async_request out of memory\n");
166 return NULL; 169 return NULL;
167 } 170 }
168 rq->dr.bRequestType = requesttype; 171 rq->dr.bRequestType = requesttype;
@@ -182,7 +185,7 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_p
182 if (!ret) 185 if (!ret)
183 return rq; 186 return rq;
184 destroy_async(&rq->ref_count); 187 destroy_async(&rq->ref_count);
185 err("submit_async_request submit_urb failed with %d", ret); 188 dev_err(&usbdev->dev, "submit_async_request submit_urb failed with %d\n", ret);
186 return NULL; 189 return NULL;
187} 190}
188 191
@@ -217,7 +220,8 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha
217 priv = pp->private_data; 220 priv = pp->private_data;
218 rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags); 221 rq = submit_async_request(priv, 3, 0xc0, ((unsigned int)reg) << 8, 0, mem_flags);
219 if (!rq) { 222 if (!rq) {
220 err("get_1284_register(%u) failed", (unsigned int)reg); 223 dev_err(&priv->usbdev->dev, "get_1284_register(%u) failed",
224 (unsigned int)reg);
221 return -EIO; 225 return -EIO;
222 } 226 }
223 if (!val) { 227 if (!val) {
@@ -248,7 +252,8 @@ static int set_1284_register(struct parport *pp, unsigned char reg, unsigned cha
248 priv = pp->private_data; 252 priv = pp->private_data;
249 rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags); 253 rq = submit_async_request(priv, 4, 0x40, (((unsigned int)reg) << 8) | val, 0, mem_flags);
250 if (!rq) { 254 if (!rq) {
251 err("set_1284_register(%u,%u) failed", (unsigned int)reg, (unsigned int)val); 255 dev_err(&priv->usbdev->dev, "set_1284_register(%u,%u) failed",
256 (unsigned int)reg, (unsigned int)val);
252 return -EIO; 257 return -EIO;
253 } 258 }
254 kref_put(&rq->ref_count, destroy_async); 259 kref_put(&rq->ref_count, destroy_async);
@@ -690,9 +695,9 @@ static int uss720_probe(struct usb_interface *intf,
690 unsigned char reg; 695 unsigned char reg;
691 int i; 696 int i;
692 697
693 dbg("probe: vendor id 0x%x, device id 0x%x\n", 698 dev_dbg(&intf->dev, "probe: vendor id 0x%x, device id 0x%x\n",
694 le16_to_cpu(usbdev->descriptor.idVendor), 699 le16_to_cpu(usbdev->descriptor.idVendor),
695 le16_to_cpu(usbdev->descriptor.idProduct)); 700 le16_to_cpu(usbdev->descriptor.idProduct));
696 701
697 /* our known interfaces have 3 alternate settings */ 702 /* our known interfaces have 3 alternate settings */
698 if (intf->num_altsetting != 3) { 703 if (intf->num_altsetting != 3) {
@@ -700,7 +705,7 @@ static int uss720_probe(struct usb_interface *intf,
700 return -ENODEV; 705 return -ENODEV;
701 } 706 }
702 i = usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 2); 707 i = usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 2);
703 dbg("set inteface result %d", i); 708 dev_dbg(&intf->dev, "set inteface result %d\n", i);
704 709
705 interface = intf->cur_altsetting; 710 interface = intf->cur_altsetting;
706 711
@@ -731,11 +736,13 @@ static int uss720_probe(struct usb_interface *intf,
731 set_1284_register(pp, 2, 0x0c, GFP_KERNEL); 736 set_1284_register(pp, 2, 0x0c, GFP_KERNEL);
732 /* debugging */ 737 /* debugging */
733 get_1284_register(pp, 0, &reg, GFP_KERNEL); 738 get_1284_register(pp, 0, &reg, GFP_KERNEL);
734 dbg("reg: %02x %02x %02x %02x %02x %02x %02x", 739 dev_dbg(&intf->dev, "reg: %02x %02x %02x %02x %02x %02x %02x\n",
735 priv->reg[0], priv->reg[1], priv->reg[2], priv->reg[3], priv->reg[4], priv->reg[5], priv->reg[6]); 740 priv->reg[0], priv->reg[1], priv->reg[2], priv->reg[3],
741 priv->reg[4], priv->reg[5], priv->reg[6]);
736 742
737 endpoint = &interface->endpoint[2]; 743 endpoint = &interface->endpoint[2];
738 dbg("epaddr %d interval %d", endpoint->desc.bEndpointAddress, endpoint->desc.bInterval); 744 dev_dbg(&intf->dev, "epaddr %d interval %d\n",
745 endpoint->desc.bEndpointAddress, endpoint->desc.bInterval);
739 parport_announce_port(pp); 746 parport_announce_port(pp);
740 747
741 usb_set_intfdata(intf, pp); 748 usb_set_intfdata(intf, pp);
@@ -753,20 +760,20 @@ static void uss720_disconnect(struct usb_interface *intf)
753 struct parport_uss720_private *priv; 760 struct parport_uss720_private *priv;
754 struct usb_device *usbdev; 761 struct usb_device *usbdev;
755 762
756 dbg("disconnect"); 763 dev_dbg(&intf->dev, "disconnect\n");
757 usb_set_intfdata(intf, NULL); 764 usb_set_intfdata(intf, NULL);
758 if (pp) { 765 if (pp) {
759 priv = pp->private_data; 766 priv = pp->private_data;
760 usbdev = priv->usbdev; 767 usbdev = priv->usbdev;
761 priv->usbdev = NULL; 768 priv->usbdev = NULL;
762 priv->pp = NULL; 769 priv->pp = NULL;
763 dbg("parport_remove_port"); 770 dev_dbg(&intf->dev, "parport_remove_port\n");
764 parport_remove_port(pp); 771 parport_remove_port(pp);
765 parport_put_port(pp); 772 parport_put_port(pp);
766 kill_all_async_requests_priv(priv); 773 kill_all_async_requests_priv(priv);
767 kref_put(&priv->ref_count, destroy_priv); 774 kref_put(&priv->ref_count, destroy_priv);
768 } 775 }
769 dbg("disconnect done"); 776 dev_dbg(&intf->dev, "disconnect done\n");
770} 777}
771 778
772/* table of cables that work through this driver */ 779/* table of cables that work through this driver */