Merge tag 'device-properties-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device property updates from Rafael J. Wysocki: "Generic device properties framework updates for v4.11-rc1 Allow built-in (static) device properties to be declared as constant, make it possible to save memory by discarding alternative (but unused) built-in (static) property sets and add support for automatic handling of built-in properties to the I2C code" * tag 'device-properties-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: i2c: allow specify device properties in i2c_board_info device property: export code duplicating array of property entries device property: constify property arrays values device property: allow to constify properties
This commit is contained in:
@@ -1336,15 +1336,29 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
|
||||
client->dev.fwnode = info->fwnode;
|
||||
|
||||
i2c_dev_set_name(adap, client);
|
||||
|
||||
if (info->properties) {
|
||||
status = device_add_properties(&client->dev, info->properties);
|
||||
if (status) {
|
||||
dev_err(&adap->dev,
|
||||
"Failed to add properties to client %s: %d\n",
|
||||
client->name, status);
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
|
||||
status = device_register(&client->dev);
|
||||
if (status)
|
||||
goto out_err;
|
||||
goto out_free_props;
|
||||
|
||||
dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n",
|
||||
client->name, dev_name(&client->dev));
|
||||
|
||||
return client;
|
||||
|
||||
out_free_props:
|
||||
if (info->properties)
|
||||
device_remove_properties(&client->dev);
|
||||
out_err:
|
||||
dev_err(&adap->dev,
|
||||
"Failed to register i2c client %s at 0x%02x (%d)\n",
|
||||
|
Reference in New Issue
Block a user