Skip to content

Commit ba13dc5

Browse files
dlechjic23
authored andcommitted
iio: proximity: vcnl3020: pass struct vcnl3020_property by pointer
Pass struct vcnl3020_property by pointer instead of by value to avoid copying the entire struct. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250628-iio-const-data-25-v1-1-5d99cf17790e@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 7e17ce3 commit ba13dc5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/iio/proximity/vcnl3020.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ static struct vcnl3020_property vcnl3020_led_current_property = {
109109
};
110110

111111
static int vcnl3020_get_and_apply_property(struct vcnl3020_data *data,
112-
struct vcnl3020_property prop)
112+
struct vcnl3020_property *prop)
113113
{
114114
int rc;
115115
u32 val;
116116

117-
rc = device_property_read_u32(data->dev, prop.name, &val);
117+
rc = device_property_read_u32(data->dev, prop->name, &val);
118118
if (rc)
119119
return 0;
120120

121-
if (prop.conversion_func)
122-
prop.conversion_func(&val);
121+
if (prop->conversion_func)
122+
prop->conversion_func(&val);
123123

124-
rc = regmap_write(data->regmap, prop.reg, val);
124+
rc = regmap_write(data->regmap, prop->reg, val);
125125
if (rc) {
126126
dev_err(data->dev, "Error (%d) setting property (%s)\n",
127-
rc, prop.name);
127+
rc, prop->name);
128128
}
129129

130130
return rc;
@@ -153,7 +153,7 @@ static int vcnl3020_init(struct vcnl3020_data *data)
153153
mutex_init(&data->lock);
154154

155155
return vcnl3020_get_and_apply_property(data,
156-
vcnl3020_led_current_property);
156+
&vcnl3020_led_current_property);
157157
};
158158

159159
static bool vcnl3020_is_in_periodic_mode(struct vcnl3020_data *data)

0 commit comments

Comments
 (0)