hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/usb/phy/phy-twl6030-usb.c
....@@ -2,7 +2,7 @@
22 /*
33 * twl6030_usb - TWL6030 USB transceiver, talking to OMAP OTG driver.
44 *
5
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
5
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com
66 *
77 * Author: Hema HK <hemahk@ti.com>
88 */
....@@ -196,6 +196,12 @@
196196 }
197197 static DEVICE_ATTR_RO(vbus);
198198
199
+static struct attribute *twl6030_attrs[] = {
200
+ &dev_attr_vbus.attr,
201
+ NULL,
202
+};
203
+ATTRIBUTE_GROUPS(twl6030);
204
+
199205 static irqreturn_t twl6030_usb_irq(int irq, void *_twl)
200206 {
201207 struct twl6030_usb *twl = _twl;
....@@ -366,8 +372,6 @@
366372 }
367373
368374 platform_set_drvdata(pdev, twl);
369
- if (device_create_file(&pdev->dev, &dev_attr_vbus))
370
- dev_warn(&pdev->dev, "could not create sysfs file\n");
371375
372376 INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
373377 INIT_DELAYED_WORK(&twl->get_status_work, twl6030_status_work);
....@@ -378,8 +382,7 @@
378382 if (status < 0) {
379383 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
380384 twl->irq1, status);
381
- device_remove_file(twl->dev, &dev_attr_vbus);
382
- return status;
385
+ goto err_put_regulator;
383386 }
384387
385388 status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq,
....@@ -388,9 +391,7 @@
388391 if (status < 0) {
389392 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
390393 twl->irq2, status);
391
- free_irq(twl->irq1, twl);
392
- device_remove_file(twl->dev, &dev_attr_vbus);
393
- return status;
394
+ goto err_free_irq1;
394395 }
395396
396397 twl->asleep = 0;
....@@ -399,6 +400,13 @@
399400 dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
400401
401402 return 0;
403
+
404
+err_free_irq1:
405
+ free_irq(twl->irq1, twl);
406
+err_put_regulator:
407
+ regulator_put(twl->usb3v3);
408
+
409
+ return status;
402410 }
403411
404412 static int twl6030_usb_remove(struct platform_device *pdev)
....@@ -413,7 +421,6 @@
413421 free_irq(twl->irq1, twl);
414422 free_irq(twl->irq2, twl);
415423 regulator_put(twl->usb3v3);
416
- device_remove_file(twl->dev, &dev_attr_vbus);
417424 cancel_work_sync(&twl->set_vbus_work);
418425
419426 return 0;
....@@ -431,6 +438,7 @@
431438 .driver = {
432439 .name = "twl6030_usb",
433440 .of_match_table = of_match_ptr(twl6030_usb_id_table),
441
+ .dev_groups = twl6030_groups,
434442 },
435443 };
436444