Commit 41145b980e3f4c7c26763fae0379f1cb8f336868

Authored by Axel Lin
Committed by Mark Brown
1 parent 2e36e140b8

regulator: pbias: Use of_device_get_match_data

Use of_device_get_match_data to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20190925101256.19030-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

drivers/regulator/pbias-regulator.c
... ... @@ -164,7 +164,6 @@
164 164 const struct pbias_reg_info *info;
165 165 int ret = 0;
166 166 int count, idx, data_idx = 0;
167   - const struct of_device_id *match;
168 167 const struct pbias_of_data *data;
169 168 unsigned int offset;
170 169  
... ... @@ -183,9 +182,8 @@
183 182 if (IS_ERR(syscon))
184 183 return PTR_ERR(syscon);
185 184  
186   - match = of_match_device(of_match_ptr(pbias_of_match), &pdev->dev);
187   - if (match && match->data) {
188   - data = match->data;
  185 + data = of_device_get_match_data(&pdev->dev);
  186 + if (data) {
189 187 offset = data->offset;
190 188 } else {
191 189 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);