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

Configure Feed

Select the types of activity you want to include in your feed.

reset: gpio: simplify fallback device matching

The of_args field of struct reset_controller_dev was introduced to allow
the reset-gpio driver to pass the phandle arguments back to reset core.
The thing is: it doesn't even have to do it. The core sets the platform
data of the auxiliary device *AND* has access to it later on during the
lookup. This means the field is unneeded and all can happen entirely in
reset core.

Remove the field from the public header and don't set it in
reset-gpio.c. Retrieve the platform data in reset core when needed
instead.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

authored by

Bartosz Golaszewski and committed by
Philipp Zabel
ad9d28e6 a9b95ce3

+6 -18
+6 -9
drivers/reset/core.c
··· 94 94 if (rcdev->of_node) 95 95 return rcdev->of_node->full_name; 96 96 97 - if (rcdev->of_args) 98 - return rcdev->of_args->np->full_name; 99 - 100 97 return NULL; 101 98 } 102 99 ··· 122 125 */ 123 126 int reset_controller_register(struct reset_controller_dev *rcdev) 124 127 { 125 - if (rcdev->of_node && rcdev->of_args) 126 - return -EINVAL; 127 - 128 128 if (!rcdev->of_xlate) { 129 129 rcdev->of_reset_n_cells = 1; 130 130 rcdev->of_xlate = of_reset_simple_xlate; ··· 1000 1006 bool gpio_fallback) 1001 1007 { 1002 1008 struct reset_controller_dev *rcdev; 1009 + struct of_phandle_args *rc_args; 1003 1010 1004 1011 lockdep_assert_held(&reset_list_mutex); 1005 1012 1006 1013 list_for_each_entry(rcdev, &reset_controller_list, list) { 1007 - if (gpio_fallback) { 1008 - if (rcdev->of_args && of_phandle_args_equal(args, 1009 - rcdev->of_args)) 1014 + if (gpio_fallback && rcdev->dev && 1015 + device_is_compatible(rcdev->dev, "reset-gpio")) { 1016 + rc_args = dev_get_platdata(rcdev->dev); 1017 + 1018 + if (of_phandle_args_equal(args, rc_args)) 1010 1019 return rcdev; 1011 1020 } else { 1012 1021 if (args->np == rcdev->of_node)
-5
drivers/reset/reset-gpio.c
··· 56 56 const struct auxiliary_device_id *id) 57 57 { 58 58 struct device *dev = &adev->dev; 59 - struct of_phandle_args *platdata = dev_get_platdata(dev); 60 59 struct reset_gpio_priv *priv; 61 - 62 - if (!platdata) 63 - return -EINVAL; 64 60 65 61 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 66 62 if (!priv) ··· 72 76 priv->rc.ops = &reset_gpio_ops; 73 77 priv->rc.owner = THIS_MODULE; 74 78 priv->rc.dev = dev; 75 - priv->rc.of_args = platdata; 76 79 77 80 /* Cells to match GPIO specifier, but it's not really used */ 78 81 priv->rc.of_reset_n_cells = 2;
-4
include/linux/reset-controller.h
··· 35 35 * @reset_control_head: head of internal list of requested reset controls 36 36 * @dev: corresponding driver model device struct 37 37 * @of_node: corresponding device tree node as phandle target 38 - * @of_args: for reset-gpios controllers: corresponding phandle args with 39 - * of_node and GPIO number complementing of_node; either this or 40 - * of_node should be present 41 38 * @of_reset_n_cells: number of cells in reset line specifiers 42 39 * @of_xlate: translation function to translate from specifier as found in the 43 40 * device tree to id as given to the reset control ops, defaults ··· 48 51 struct list_head reset_control_head; 49 52 struct device *dev; 50 53 struct device_node *of_node; 51 - const struct of_phandle_args *of_args; 52 54 int of_reset_n_cells; 53 55 int (*of_xlate)(struct reset_controller_dev *rcdev, 54 56 const struct of_phandle_args *reset_spec);