Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: phy-generic: Delete unused platform data

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>

authored by

Linus Walleij and committed by
Greg Kroah-Hartman
b267ddf6 7b813767

+15 -43
+1 -1
drivers/usb/phy/phy-am335x.c
··· 57 57 58 58 am_phy->dr_mode = of_usb_get_dr_mode_by_phy(pdev->dev.of_node, -1); 59 59 60 - ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen, NULL); 60 + ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen); 61 61 if (ret) 62 62 return ret; 63 63
+12 -27
drivers/usb/phy/phy-generic.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/regulator/consumer.h> 23 23 #include <linux/of.h> 24 - #include <linux/of_gpio.h> 25 - #include <linux/gpio.h> 24 + #include <linux/gpio/consumer.h> 26 25 #include <linux/delay.h> 27 26 28 27 #include "phy-generic.h" ··· 203 204 return 0; 204 205 } 205 206 206 - int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, 207 - struct usb_phy_generic_platform_data *pdata) 207 + int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) 208 208 { 209 209 enum usb_phy_type type = USB_PHY_TYPE_USB2; 210 210 int err = 0; ··· 219 221 220 222 needs_vcc = of_property_read_bool(node, "vcc-supply"); 221 223 needs_clk = of_property_read_bool(node, "clocks"); 222 - nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", 223 - GPIOD_ASIS); 224 - err = PTR_ERR_OR_ZERO(nop->gpiod_reset); 225 - if (!err) { 226 - nop->gpiod_vbus = devm_gpiod_get_optional(dev, 227 - "vbus-detect", 228 - GPIOD_ASIS); 229 - err = PTR_ERR_OR_ZERO(nop->gpiod_vbus); 230 - } 231 - } else if (pdata) { 232 - type = pdata->type; 233 - clk_rate = pdata->clk_rate; 234 - needs_vcc = pdata->needs_vcc; 235 - if (gpio_is_valid(pdata->gpio_reset)) { 236 - err = devm_gpio_request_one(dev, pdata->gpio_reset, 237 - GPIOF_ACTIVE_LOW, 238 - dev_name(dev)); 239 - if (!err) 240 - nop->gpiod_reset = 241 - gpio_to_desc(pdata->gpio_reset); 242 - } 243 - nop->gpiod_vbus = pdata->gpiod_vbus; 224 + } 225 + nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", 226 + GPIOD_ASIS); 227 + err = PTR_ERR_OR_ZERO(nop->gpiod_reset); 228 + if (!err) { 229 + nop->gpiod_vbus = devm_gpiod_get_optional(dev, 230 + "vbus-detect", 231 + GPIOD_ASIS); 232 + err = PTR_ERR_OR_ZERO(nop->gpiod_vbus); 244 233 } 245 234 246 235 if (err == -EPROBE_DEFER) ··· 293 308 if (!nop) 294 309 return -ENOMEM; 295 310 296 - err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev)); 311 + err = usb_phy_gen_create_phy(dev, nop); 297 312 if (err) 298 313 return err; 299 314 if (nop->gpiod_vbus) {
+1 -2
drivers/usb/phy/phy-generic.h
··· 22 22 int usb_gen_phy_init(struct usb_phy *phy); 23 23 void usb_gen_phy_shutdown(struct usb_phy *phy); 24 24 25 - int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, 26 - struct usb_phy_generic_platform_data *pdata); 25 + int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop); 27 26 28 27 #endif
+1 -1
drivers/usb/phy/phy-keystone.c
··· 76 76 if (IS_ERR(k_phy->phy_ctrl)) 77 77 return PTR_ERR(k_phy->phy_ctrl); 78 78 79 - ret = usb_phy_gen_create_phy(dev, &k_phy->usb_phy_gen, NULL); 79 + ret = usb_phy_gen_create_phy(dev, &k_phy->usb_phy_gen); 80 80 if (ret) 81 81 return ret; 82 82
-12
include/linux/usb/usb_phy_generic.h
··· 3 3 #define __LINUX_USB_NOP_XCEIV_H 4 4 5 5 #include <linux/usb/otg.h> 6 - #include <linux/gpio/consumer.h> 7 - 8 - struct usb_phy_generic_platform_data { 9 - enum usb_phy_type type; 10 - unsigned long clk_rate; 11 - 12 - /* if set fails with -EPROBE_DEFER if can't get regulator */ 13 - unsigned int needs_vcc:1; 14 - unsigned int needs_reset:1; /* deprecated */ 15 - int gpio_reset; 16 - struct gpio_desc *gpiod_vbus; 17 - }; 18 6 19 7 #if IS_ENABLED(CONFIG_NOP_USB_XCEIV) 20 8 /* sometimes transceivers are accessed only through e.g. ULPI */