hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/muxes/i2c-mux-pinctrl.c
....@@ -1,19 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * I2C multiplexer using pinctrl API
34 *
45 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms and conditions of the GNU General Public License,
8
- * version 2, as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
176 */
187
198 #include <linux/i2c.h>
....@@ -27,7 +16,7 @@
2716
2817 struct i2c_mux_pinctrl {
2918 struct pinctrl *pinctrl;
30
- struct pinctrl_state **states;
19
+ struct pinctrl_state *states[];
3120 };
3221
3322 static int i2c_mux_pinctrl_select(struct i2c_mux_core *muxc, u32 chan)
....@@ -104,14 +93,13 @@
10493 return PTR_ERR(parent);
10594
10695 muxc = i2c_mux_alloc(parent, dev, num_names,
107
- sizeof(*mux) + num_names * sizeof(*mux->states),
96
+ struct_size(mux, states, num_names),
10897 0, i2c_mux_pinctrl_select, NULL);
10998 if (!muxc) {
11099 ret = -ENOMEM;
111100 goto err_put_parent;
112101 }
113102 mux = i2c_mux_priv(muxc);
114
- mux->states = (struct pinctrl_state **)(mux + 1);
115103
116104 platform_set_drvdata(pdev, muxc);
117105