]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: phy-generic: Delete unused platform data
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 31 Dec 2019 17:42:35 +0000 (18:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2020 09:39:20 +0000 (10:39 +0100)
The last user of the phy generic platform data was
deleted in commit 1e041b6f313aaa966612a7e415cfc09c90d6b829
("usb: dwc3: exynos: Remove dead code"). So get rid of
the platform data, which rids us of another consumer of
the legacy GPIO API at the same time. Make sure we
only inlcude <linux/gpio/consumer.h> which is all we use.

Alter the usb_phy_gen_create_phy() function prototype to
not pass any platform data as this is just hardcoded to
NULL at all locations calling it in the kernel.

Move the devm_gpiod_get* calls out of the if (of_node)
parenthesis, as these calls are generic and do not depend
on device tree, they are used by any hardware description.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/phy/phy-am335x.c
drivers/usb/phy/phy-generic.c
drivers/usb/phy/phy-generic.h
drivers/usb/phy/phy-keystone.c
include/linux/usb/usb_phy_generic.h

index f5f0568d8533e111a6d1287d0ef39916005efbb3..8524475d942d496e62aa757ce541955a84759f15 100644 (file)
@@ -57,7 +57,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
 
        am_phy->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1);
 
-       ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen, NULL);
+       ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen);
        if (ret)
                return ret;
 
index a53b89be5324819479e5d346d1f165b37daad55d..661a229c105ddd171438c71e3ef7f5964cab6d2d 100644 (file)
@@ -21,8 +21,7 @@
 #include <linux/clk.h>
 #include <linux/regulator/consumer.h>
 #include <linux/of.h>
-#include <linux/of_gpio.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/delay.h>
 
 #include "phy-generic.h"
@@ -204,8 +203,7 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host)
        return 0;
 }
 
-int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
-               struct usb_phy_generic_platform_data *pdata)
+int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
 {
        enum usb_phy_type type = USB_PHY_TYPE_USB2;
        int err = 0;
@@ -221,28 +219,15 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
 
                needs_vcc = of_property_read_bool(node, "vcc-supply");
                needs_clk = of_property_read_bool(node, "clocks");
-               nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
-                                                          GPIOD_ASIS);
-               err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
-               if (!err) {
-                       nop->gpiod_vbus = devm_gpiod_get_optional(dev,
-                                                        "vbus-detect",
-                                                        GPIOD_ASIS);
-                       err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
-               }
-       } else if (pdata) {
-               type = pdata->type;
-               clk_rate = pdata->clk_rate;
-               needs_vcc = pdata->needs_vcc;
-               if (gpio_is_valid(pdata->gpio_reset)) {
-                       err = devm_gpio_request_one(dev, pdata->gpio_reset,
-                                                   GPIOF_ACTIVE_LOW,
-                                                   dev_name(dev));
-                       if (!err)
-                               nop->gpiod_reset =
-                                       gpio_to_desc(pdata->gpio_reset);
-               }
-               nop->gpiod_vbus = pdata->gpiod_vbus;
+       }
+       nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
+                                                  GPIOD_ASIS);
+       err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
+       if (!err) {
+               nop->gpiod_vbus = devm_gpiod_get_optional(dev,
+                                                "vbus-detect",
+                                                GPIOD_ASIS);
+               err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
        }
 
        if (err == -EPROBE_DEFER)
@@ -308,7 +293,7 @@ static int usb_phy_generic_probe(struct platform_device *pdev)
        if (!nop)
                return -ENOMEM;
 
-       err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev));
+       err = usb_phy_gen_create_phy(dev, nop);
        if (err)
                return err;
        if (nop->gpiod_vbus) {
index 97289627561da73d7041720766e609883c2b3b7c..7ee80211a688c33674a4e396525dbc2bb23c0c1a 100644 (file)
@@ -22,7 +22,6 @@ struct usb_phy_generic {
 int usb_gen_phy_init(struct usb_phy *phy);
 void usb_gen_phy_shutdown(struct usb_phy *phy);
 
-int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
-               struct usb_phy_generic_platform_data *pdata);
+int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop);
 
 #endif
index 110e6e9ad6215157e0af629e33e961e090c1d217..9c226b57153b739a7a155ead92fb96de46dae2a6 100644 (file)
@@ -76,7 +76,7 @@ static int keystone_usbphy_probe(struct platform_device *pdev)
        if (IS_ERR(k_phy->phy_ctrl))
                return PTR_ERR(k_phy->phy_ctrl);
 
-       ret = usb_phy_gen_create_phy(dev, &k_phy->usb_phy_gen, NULL);
+       ret = usb_phy_gen_create_phy(dev, &k_phy->usb_phy_gen);
        if (ret)
                return ret;
 
index 7408cf52c7100892144227454756ba1dd8cfbbec..cd9e70a552a0eb06c761f5b019a82bd0f6d2a642 100644 (file)
@@ -3,18 +3,6 @@
 #define __LINUX_USB_NOP_XCEIV_H
 
 #include <linux/usb/otg.h>
-#include <linux/gpio/consumer.h>
-
-struct usb_phy_generic_platform_data {
-       enum usb_phy_type type;
-       unsigned long clk_rate;
-
-       /* if set fails with -EPROBE_DEFER if can't get regulator */
-       unsigned int needs_vcc:1;
-       unsigned int needs_reset:1;     /* deprecated */
-       int gpio_reset;
-       struct gpio_desc *gpiod_vbus;
-};
 
 #if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
 /* sometimes transceivers are accessed only through e.g. ULPI */