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.

pwm: Drop useless member .of_pwm_n_cells of struct pwm_chip

Apart from the two of_xlate implementations this member is write-only.
In the of_xlate functions of_pwm_xlate_with_flags() and
of_pwm_single_xlate() it's more sensible to check for args->args_count
because this is what is actually used in the device tree.

Acked-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/53d8c545aa8f79a920358be9e72e382b3981bdc4.1704835845.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+4 -27
-1
drivers/gpu/drm/bridge/ti-sn65dsi86.c
··· 1591 1591 pdata->pchip.ops = &ti_sn_pwm_ops; 1592 1592 pdata->pchip.npwm = 1; 1593 1593 pdata->pchip.of_xlate = of_pwm_single_xlate; 1594 - pdata->pchip.of_pwm_n_cells = 1; 1595 1594 1596 1595 devm_pm_runtime_enable(&adev->dev); 1597 1596
+3 -19
drivers/pwm/core.c
··· 107 107 { 108 108 struct pwm_device *pwm; 109 109 110 - if (chip->of_pwm_n_cells < 2) 111 - return ERR_PTR(-EINVAL); 112 - 113 110 /* flags in the third cell are optional */ 114 111 if (args->args_count < 2) 115 112 return ERR_PTR(-EINVAL); ··· 121 124 pwm->args.period = args->args[1]; 122 125 pwm->args.polarity = PWM_POLARITY_NORMAL; 123 126 124 - if (chip->of_pwm_n_cells >= 3) { 125 - if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED) 126 - pwm->args.polarity = PWM_POLARITY_INVERSED; 127 - } 127 + if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED) 128 + pwm->args.polarity = PWM_POLARITY_INVERSED; 128 129 129 130 return pwm; 130 131 } ··· 132 137 of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args) 133 138 { 134 139 struct pwm_device *pwm; 135 - 136 - if (chip->of_pwm_n_cells < 1) 137 - return ERR_PTR(-EINVAL); 138 140 139 141 /* validate that one cell is specified, optionally with flags */ 140 142 if (args->args_count != 1 && args->args_count != 2) ··· 156 164 if (!chip->dev || !chip->dev->of_node) 157 165 return; 158 166 159 - if (!chip->of_xlate) { 160 - u32 pwm_cells; 161 - 162 - if (of_property_read_u32(chip->dev->of_node, "#pwm-cells", 163 - &pwm_cells)) 164 - pwm_cells = 2; 165 - 167 + if (!chip->of_xlate) 166 168 chip->of_xlate = of_pwm_xlate_with_flags; 167 - chip->of_pwm_n_cells = pwm_cells; 168 - } 169 169 170 170 of_node_get(chip->dev->of_node); 171 171 }
-1
drivers/pwm/pwm-clps711x.c
··· 103 103 priv->chip.dev = &pdev->dev; 104 104 priv->chip.npwm = 2; 105 105 priv->chip.of_xlate = clps711x_pwm_xlate; 106 - priv->chip.of_pwm_n_cells = 1; 107 106 108 107 spin_lock_init(&priv->lock); 109 108
-1
drivers/pwm/pwm-cros-ec.c
··· 279 279 chip->dev = dev; 280 280 chip->ops = &cros_ec_pwm_ops; 281 281 chip->of_xlate = cros_ec_pwm_xlate; 282 - chip->of_pwm_n_cells = 1; 283 282 284 283 if (ec_pwm->use_pwm_type) { 285 284 chip->npwm = CROS_EC_PWM_DT_COUNT;
+1 -3
drivers/pwm/pwm-pxa.c
··· 180 180 pc->chip.ops = &pxa_pwm_ops; 181 181 pc->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1; 182 182 183 - if (IS_ENABLED(CONFIG_OF)) { 183 + if (IS_ENABLED(CONFIG_OF)) 184 184 pc->chip.of_xlate = of_pwm_single_xlate; 185 - pc->chip.of_pwm_n_cells = 1; 186 - } 187 185 188 186 pc->mmio_base = devm_platform_ioremap_resource(pdev, 0); 189 187 if (IS_ERR(pc->mmio_base))
-2
include/linux/pwm.h
··· 271 271 * @id: unique number of this PWM chip 272 272 * @npwm: number of PWMs controlled by this chip 273 273 * @of_xlate: request a PWM device given a device tree PWM specifier 274 - * @of_pwm_n_cells: number of cells expected in the device tree PWM specifier 275 274 * @atomic: can the driver's ->apply() be called in atomic context 276 275 * @pwms: array of PWM devices allocated by the framework 277 276 */ ··· 283 284 284 285 struct pwm_device * (*of_xlate)(struct pwm_chip *chip, 285 286 const struct of_phandle_args *args); 286 - unsigned int of_pwm_n_cells; 287 287 bool atomic; 288 288 289 289 /* only used internally by the PWM framework */