Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a332c96 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Linus Walleij
Browse files

pinctrl: sh-pfc: sh73a0: Remove unnecessary SoC data allocation



The SoC data structure allocated at init time only holds a regulator
pointer that is only used in the init function. Replace it with a local
variable and get rid of the SoC data structure allocation altogether.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 6064b147
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -542,7 +542,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
	 */
	ret = sh_pfc_register_pinctrl(pfc);
	if (unlikely(ret != 0))
		goto error;
		return ret;

#ifdef CONFIG_GPIO_SH_PFC
	/*
@@ -564,11 +564,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
	dev_info(pfc->dev, "%s support registered\n", info->name);

	return 0;

error:
	if (info->ops && info->ops->exit)
		info->ops->exit(pfc);
	return ret;
}

static int sh_pfc_remove(struct platform_device *pdev)
@@ -580,9 +575,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
#endif
	sh_pfc_unregister_pinctrl(pfc);

	if (pfc->info->ops && pfc->info->ops->exit)
		pfc->info->ops->exit(pfc);

	return 0;
}

+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ struct sh_pfc_pin_range {
struct sh_pfc {
	struct device *dev;
	const struct sh_pfc_soc_info *info;
	void *soc_data;
	spinlock_t lock;

	unsigned int num_windows;
+4 −15
Original line number Diff line number Diff line
@@ -3824,35 +3824,24 @@ static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
 * SoC information
 */

struct sh73a0_pinmux_data {
	struct regulator_dev *vccq_mc0;
};

static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
{
	struct sh73a0_pinmux_data *data;
	struct regulator_config cfg = { };
	struct regulator_dev *vccq;
	int ret;

	data = devm_kzalloc(pfc->dev, sizeof(*data), GFP_KERNEL);
	if (data == NULL)
		return -ENOMEM;

	cfg.dev = pfc->dev;
	cfg.init_data = &sh73a0_vccq_mc0_init_data;
	cfg.driver_data = pfc;

	data->vccq_mc0 = devm_regulator_register(pfc->dev,
						 &sh73a0_vccq_mc0_desc, &cfg);
	if (IS_ERR(data->vccq_mc0)) {
		ret = PTR_ERR(data->vccq_mc0);
	vccq = devm_regulator_register(pfc->dev, &sh73a0_vccq_mc0_desc, &cfg);
	if (IS_ERR(vccq)) {
		ret = PTR_ERR(vccq);
		dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
			ret);
		return ret;
	}

	pfc->soc_data = data;

	return 0;
}

+0 −1
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ struct sh_pfc;

struct sh_pfc_soc_operations {
	int (*init)(struct sh_pfc *pfc);
	void (*exit)(struct sh_pfc *pfc);
	unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
	void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
			 unsigned int bias);