Skip to content

Commit 32d4536

Browse files
skittwsakernel
authored andcommitted
docs: i2c: reference simple probes
Instead of documenting old-style probes, reference "simple probes" and document the i2c_match_id function. This might help reduce the use of two-argument probes in new code. Signed-off-by: Stephen Kitt <steve@sk2.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 43bf42f commit 32d4536

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Documentation/i2c/writing-clients.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ driver model device node, and its I2C address.
4646
},
4747

4848
.id_table = foo_idtable,
49-
.probe = foo_probe,
49+
.probe_new = foo_probe,
5050
.remove = foo_remove,
5151
/* if device autodetection is needed: */
5252
.class = I2C_CLASS_SOMETHING,
@@ -155,8 +155,7 @@ those devices, and a remove() method to unbind.
155155

156156
::
157157

158-
static int foo_probe(struct i2c_client *client,
159-
const struct i2c_device_id *id);
158+
static int foo_probe(struct i2c_client *client);
160159
static int foo_remove(struct i2c_client *client);
161160

162161
Remember that the i2c_driver does not create those client handles. The
@@ -165,8 +164,12 @@ handle may be used during foo_probe(). If foo_probe() reports success
165164
foo_remove() returns. That binding model is used by most Linux drivers.
166165

167166
The probe function is called when an entry in the id_table name field
168-
matches the device's name. It is passed the entry that was matched so
169-
the driver knows which one in the table matched.
167+
matches the device's name. If the probe function needs that entry, it
168+
can retrieve it using
169+
170+
::
171+
172+
const struct i2c_device_id *id = i2c_match_id(foo_idtable, client);
170173

171174

172175
Device Creation

0 commit comments

Comments
 (0)