Skip to content

Commit a5c6a1f

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: - a small collection of remaining API conversion patches (all acked) which allow to finally remove the deprecated API - some documentation fixes and a MAINTAINERS addition * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: MAINTAINERS: Add robert and myself as qcom i2c cci maintainers i2c: smbus: Fix spelling mistake in the comments Documentation/i2c: SMBus start signal is S not A i2c: remove deprecated i2c_new_device API Documentation: media: convert to use i2c_new_client_device() video: backlight: tosa_lcd: convert to use i2c_new_client_device() x86/platform/intel-mid: convert to use i2c_new_client_device() drm: encoder_slave: use new I2C API drm: encoder_slave: fix refcouting error for modules
2 parents 8b6ddd1 + 28f9f8f commit a5c6a1f

File tree

10 files changed

+25
-48
lines changed

10 files changed

+25
-48
lines changed

Documentation/driver-api/media/v4l2-subdev.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ The bridge driver also has some helper functions it can use:
451451
"module_foo", "chipid", 0x36, NULL);
452452
453453
This loads the given module (can be ``NULL`` if no module needs to be loaded)
454-
and calls :c:func:`i2c_new_device` with the given ``i2c_adapter`` and
454+
and calls :c:func:`i2c_new_client_device` with the given ``i2c_adapter`` and
455455
chip/address arguments. If all goes well, then it registers the subdev with
456456
the v4l2_device.
457457

Documentation/i2c/smbus-protocol.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ SMBus Quick Command
5757

5858
This sends a single bit to the device, at the place of the Rd/Wr bit::
5959

60-
A Addr Rd/Wr [A] P
60+
S Addr Rd/Wr [A] P
6161

6262
Functionality flag: I2C_FUNC_SMBUS_QUICK
6363

Documentation/userspace-api/media/conf_nitpick.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
("c:func", "copy_to_user"),
2828
("c:func", "determine_valid_ioctls"),
2929
("c:func", "ERR_PTR"),
30-
("c:func", "i2c_new_device"),
30+
("c:func", "i2c_new_client_device"),
3131
("c:func", "ioctl"),
3232
("c:func", "IS_ERR"),
3333
("c:func", "KERNEL_VERSION"),

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14196,6 +14196,15 @@ L: [email protected]
1419614196
S: Supported
1419714197
F: drivers/dma/qcom/hidma*
1419814198

14199+
QUALCOMM I2C CCI DRIVER
14200+
M: Loic Poulain <[email protected]>
14201+
M: Robert Foss <[email protected]>
14202+
14203+
14204+
S: Maintained
14205+
F: Documentation/devicetree/bindings/i2c/i2c-qcom-cci.txt
14206+
F: drivers/i2c/busses/i2c-qcom-cci.c
14207+
1419914208
QUALCOMM IOMMU
1420014209
M: Rob Clark <[email protected]>
1420114210

arch/x86/platform/intel-mid/sfi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ void intel_scu_devices_create(void)
287287

288288
adapter = i2c_get_adapter(i2c_bus[i]);
289289
if (adapter) {
290-
client = i2c_new_device(adapter, i2c_devs[i]);
291-
if (!client)
290+
client = i2c_new_client_device(adapter, i2c_devs[i]);
291+
if (IS_ERR(client))
292292
pr_err("can't create i2c device %s\n",
293293
i2c_devs[i]->type);
294294
} else

drivers/gpu/drm/drm_encoder_slave.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev,
6161

6262
request_module("%s%s", I2C_MODULE_PREFIX, info->type);
6363

64-
client = i2c_new_device(adap, info);
65-
if (!client) {
66-
err = -ENOMEM;
67-
goto fail;
68-
}
69-
70-
if (!client->dev.driver) {
64+
client = i2c_new_client_device(adap, info);
65+
if (!i2c_client_has_driver(client)) {
7166
err = -ENODEV;
7267
goto fail_unregister;
7368
}
@@ -84,18 +79,18 @@ int drm_i2c_encoder_init(struct drm_device *dev,
8479

8580
err = encoder_drv->encoder_init(client, dev, encoder);
8681
if (err)
87-
goto fail_unregister;
82+
goto fail_module_put;
8883

8984
if (info->platform_data)
9085
encoder->slave_funcs->set_config(&encoder->base,
9186
info->platform_data);
9287

9388
return 0;
9489

90+
fail_module_put:
91+
module_put(module);
9592
fail_unregister:
9693
i2c_unregister_device(client);
97-
module_put(module);
98-
fail:
9994
return err;
10095
}
10196
EXPORT_SYMBOL(drm_i2c_encoder_init);

drivers/i2c/i2c-core-base.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -815,31 +815,6 @@ i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *inf
815815
}
816816
EXPORT_SYMBOL_GPL(i2c_new_client_device);
817817

818-
/**
819-
* i2c_new_device - instantiate an i2c device
820-
* @adap: the adapter managing the device
821-
* @info: describes one I2C device; bus_num is ignored
822-
* Context: can sleep
823-
*
824-
* This deprecated function has the same functionality as
825-
* @i2c_new_client_device, it just returns NULL instead of an ERR_PTR in case of
826-
* an error for compatibility with current I2C API. It will be removed once all
827-
* users are converted.
828-
*
829-
* This returns the new i2c client, which may be saved for later use with
830-
* i2c_unregister_device(); or NULL to indicate an error.
831-
*/
832-
struct i2c_client *
833-
i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
834-
{
835-
struct i2c_client *ret;
836-
837-
ret = i2c_new_client_device(adap, info);
838-
return IS_ERR(ret) ? NULL : ret;
839-
}
840-
EXPORT_SYMBOL_GPL(i2c_new_device);
841-
842-
843818
/**
844819
* i2c_unregister_device - reverse effect of i2c_new_*_device()
845820
* @client: value returned from i2c_new_*_device()

drivers/i2c/i2c-core-smbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* This file contains the SMBus functions which are always included in the I2C
66
* core because they can be emulated via I2C. SMBus specific extensions
7-
* (e.g. smbalert) are handled in a seperate i2c-smbus module.
7+
* (e.g. smbalert) are handled in a separate i2c-smbus module.
88
*
99
* All SMBus-related things are written by Frodo Looijaard <[email protected]>
1010
* SMBus 2.0 support by Mark Studebaker <[email protected]> and

drivers/video/backlight/tosa_lcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
107107
/* TG LCD GVSS */
108108
tosa_tg_send(spi, TG_PINICTL, 0x0);
109109

110-
if (!data->i2c) {
110+
if (IS_ERR_OR_NULL(data->i2c)) {
111111
/*
112112
* after the pannel is powered up the first time,
113113
* we can access the i2c bus so probe for the DAC
@@ -119,7 +119,7 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
119119
.addr = DAC_BASE,
120120
.platform_data = data->spi,
121121
};
122-
data->i2c = i2c_new_device(adap, &info);
122+
data->i2c = i2c_new_client_device(adap, &info);
123123
}
124124
}
125125

include/linux/i2c.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
408408
* that are present. This information is used to grow the driver model tree.
409409
* For mainboards this is done statically using i2c_register_board_info();
410410
* bus numbers identify adapters that aren't yet available. For add-on boards,
411-
* i2c_new_device() does this dynamically with the adapter already known.
411+
* i2c_new_client_device() does this dynamically with the adapter already known.
412412
*/
413413
struct i2c_board_info {
414414
char type[I2C_NAME_SIZE];
@@ -439,13 +439,11 @@ struct i2c_board_info {
439439

440440

441441
#if IS_ENABLED(CONFIG_I2C)
442-
/* Add-on boards should register/unregister their devices; e.g. a board
442+
/*
443+
* Add-on boards should register/unregister their devices; e.g. a board
443444
* with integrated I2C, a config eeprom, sensors, and a codec that's
444445
* used in conjunction with the primary hardware.
445446
*/
446-
struct i2c_client *
447-
i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
448-
449447
struct i2c_client *
450448
i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
451449

0 commit comments

Comments
 (0)