hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/i2c/muxes/i2c-demux-pinctrl.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Pinctrl based I2C DeMultiplexer
34 *
45 * Copyright (C) 2015-16 by Wolfram Sang, Sang Engineering <wsa@sang-engineering.com>
56 * Copyright (C) 2015-16 by Renesas Electronics Corporation
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the
9
- * Free Software Foundation; version 2 of the License.
107 *
118 * See the bindings doc for DTS setup and the sysfs doc for usage information.
129 * (look for filenames containing 'i2c-demux-pinctrl' in Documentation/)
....@@ -99,6 +96,8 @@
9996
10097 /* Now fill out current adapter structure. cur_chan must be up to date */
10198 priv->algo.master_xfer = i2c_demux_master_xfer;
99
+ if (adap->algo->master_xfer_atomic)
100
+ priv->algo.master_xfer_atomic = i2c_demux_master_xfer;
102101 priv->algo.functionality = i2c_demux_functionality;
103102
104103 snprintf(priv->cur_adap.name, sizeof(priv->cur_adap.name),
....@@ -219,8 +218,8 @@
219218 return -EINVAL;
220219 }
221220
222
- priv = devm_kzalloc(&pdev->dev, sizeof(*priv)
223
- + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL);
221
+ priv = devm_kzalloc(&pdev->dev, struct_size(priv, chan, num_chan),
222
+ GFP_KERNEL);
224223
225224 props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL);
226225
....@@ -262,7 +261,7 @@
262261
263262 err = device_create_file(&pdev->dev, &dev_attr_available_masters);
264263 if (err)
265
- goto err_rollback;
264
+ goto err_rollback_activation;
266265
267266 err = device_create_file(&pdev->dev, &dev_attr_current_master);
268267 if (err)
....@@ -272,8 +271,9 @@
272271
273272 err_rollback_available:
274273 device_remove_file(&pdev->dev, &dev_attr_available_masters);
275
-err_rollback:
274
+err_rollback_activation:
276275 i2c_demux_deactivate_master(priv);
276
+err_rollback:
277277 for (j = 0; j < i; j++) {
278278 of_node_put(priv->chan[j].parent_np);
279279 of_changeset_destroy(&priv->chan[j].chgset);