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

clk: BD718x7: Do not depend on parent driver data

The bd718x7 only needs a regmap from parent device. This can be
obtained by call to dev_get_regmap. Do not require parent to
populate the driver data for this.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20210105123028.GA3409663@localhost.localdomain
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Matti Vaittinen and committed by
Stephen Boyd
ddddfafd 5c8fe583

+7 -5
+7 -5
drivers/clk/clk-bd718x7.c
··· 31 31 u8 reg; 32 32 u8 mask; 33 33 struct platform_device *pdev; 34 - struct rohm_regmap_dev *mfd; 34 + struct regmap *regmap; 35 35 }; 36 36 37 37 static int bd71837_clk_set(struct bd718xx_clk *c, unsigned int status) 38 38 { 39 - return regmap_update_bits(c->mfd->regmap, c->reg, c->mask, status); 39 + return regmap_update_bits(c->regmap, c->reg, c->mask, status); 40 40 } 41 41 42 42 static void bd71837_clk_disable(struct clk_hw *hw) ··· 62 62 int rval; 63 63 struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw); 64 64 65 - rval = regmap_read(c->mfd->regmap, c->reg, &enabled); 65 + rval = regmap_read(c->regmap, c->reg, &enabled); 66 66 67 67 if (rval) 68 68 return rval; ··· 82 82 int rval = -ENOMEM; 83 83 const char *parent_clk; 84 84 struct device *parent = pdev->dev.parent; 85 - struct rohm_regmap_dev *mfd = dev_get_drvdata(parent); 86 85 struct clk_init_data init = { 87 86 .name = "bd718xx-32k-out", 88 87 .ops = &bd71837_clk_ops, ··· 91 92 c = devm_kzalloc(&pdev->dev, sizeof(*c), GFP_KERNEL); 92 93 if (!c) 93 94 return -ENOMEM; 95 + 96 + c->regmap = dev_get_regmap(pdev->dev.parent, NULL); 97 + if (!c->regmap) 98 + return -ENODEV; 94 99 95 100 init.num_parents = 1; 96 101 parent_clk = of_clk_get_parent_name(parent->of_node, 0); ··· 122 119 dev_err(&pdev->dev, "Unknown clk chip\n"); 123 120 return -EINVAL; 124 121 } 125 - c->mfd = mfd; 126 122 c->pdev = pdev; 127 123 c->hw.init = &init; 128 124