Skip to content

Commit 207cea1

Browse files
qzedStollD
authored andcommitted
platform/surface: aggregator: Rename top-level request functions to avoid ambiguities
We currently have a struct ssam_request_sync and a function ssam_request_sync(). While this is valid C, there are some downsides to it. One of these is that current Sphinx versions (>= 3.0) cannot disambiguate between the two (see disucssion and pull request linked below). It instead emits a "WARNING: Duplicate C declaration" and links for the struct and function in the resulting documentation link to the same entry (i.e. both to either function or struct documentation) instead of their respective own entries. While we could just ignore that and wait for a fix, there's also a point to be made that the current naming can be somewhat confusing when searching (e.g. via grep) or trying to understand the levels of abstraction at play: We currently have struct ssam_request_sync and associated functions ssam_request_sync_[alloc|free|init|wait|...]() operating on this struct. However, function ssam_request_sync() is one abstraction level above this. Similarly, ssam_request_sync_with_buffer() is not a function operating on struct ssam_request_sync, but rather a sibling to ssam_request_sync(), both using the struct under the hood. Therefore, rename the top level request functions: ssam_request_sync() -> ssam_request_do_sync() ssam_request_sync_with_buffer() -> ssam_request_do_sync_with_buffer() ssam_request_sync_onstack() -> ssam_request_do_sync_onstack() Link: https://lore.kernel.org/all/085e0ada65c11da9303d07e70c510dc45f21315b.1656756450.git.mchehab@kernel.org/ Link: sphinx-doc/sphinx#8313 Signed-off-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Patchset: surface-sam
1 parent 6985160 commit 207cea1

File tree

10 files changed

+66
-66
lines changed

10 files changed

+66
-66
lines changed

Documentation/driver-api/surface_aggregator/client.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
.. |ssam_notifier_unregister| replace:: :c:func:`ssam_notifier_unregister`
2020
.. |ssam_device_notifier_register| replace:: :c:func:`ssam_device_notifier_register`
2121
.. |ssam_device_notifier_unregister| replace:: :c:func:`ssam_device_notifier_unregister`
22-
.. |ssam_request_sync| replace:: :c:func:`ssam_request_sync`
22+
.. |ssam_request_do_sync| replace:: :c:func:`ssam_request_do_sync`
2323
.. |ssam_event_mask| replace:: :c:type:`enum ssam_event_mask <ssam_event_mask>`
2424

2525

@@ -209,12 +209,12 @@ data received from it is converted from little-endian to host endianness.
209209
* with the SSAM_REQUEST_HAS_RESPONSE flag set in the specification
210210
* above.
211211
*/
212-
status = ssam_request_sync(ctrl, &rqst, &resp);
212+
status = ssam_request_do_sync(ctrl, &rqst, &resp);
213213
214214
/*
215215
* Alternatively use
216216
*
217-
* ssam_request_sync_onstack(ctrl, &rqst, &resp, sizeof(arg_le));
217+
* ssam_request_do_sync_onstack(ctrl, &rqst, &resp, sizeof(arg_le));
218218
*
219219
* to perform the request, allocating the message buffer directly
220220
* on the stack as opposed to allocation via kzalloc().
@@ -230,7 +230,7 @@ data received from it is converted from little-endian to host endianness.
230230
return status;
231231
}
232232
233-
Note that |ssam_request_sync| in its essence is a wrapper over lower-level
233+
Note that |ssam_request_do_sync| in its essence is a wrapper over lower-level
234234
request primitives, which may also be used to perform requests. Refer to its
235235
implementation and documentation for more details.
236236

drivers/hid/surface-hid/surface_hid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int ssam_hid_get_descriptor(struct surface_hid_device *shid, u8 entry, u8
8080

8181
rsp.length = 0;
8282

83-
status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp,
83+
status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp,
8484
sizeof(*slice));
8585
if (status)
8686
return status;
@@ -131,7 +131,7 @@ static int ssam_hid_set_raw_report(struct surface_hid_device *shid, u8 rprt_id,
131131

132132
buf[0] = rprt_id;
133133

134-
return ssam_retry(ssam_request_sync, shid->ctrl, &rqst, NULL);
134+
return ssam_retry(ssam_request_do_sync, shid->ctrl, &rqst, NULL);
135135
}
136136

137137
static int ssam_hid_get_raw_report(struct surface_hid_device *shid, u8 rprt_id, u8 *buf, size_t len)
@@ -151,7 +151,7 @@ static int ssam_hid_get_raw_report(struct surface_hid_device *shid, u8 rprt_id,
151151
rsp.length = 0;
152152
rsp.pointer = buf;
153153

154-
return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(rprt_id));
154+
return ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(rprt_id));
155155
}
156156

157157
static u32 ssam_hid_event_fn(struct ssam_event_notifier *nf, const struct ssam_event *event)

drivers/hid/surface-hid/surface_kbd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int ssam_kbd_get_descriptor(struct surface_hid_device *shid, u8 entry, u8
4949
rsp.length = 0;
5050
rsp.pointer = buf;
5151

52-
status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(entry));
52+
status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(entry));
5353
if (status)
5454
return status;
5555

@@ -75,7 +75,7 @@ static int ssam_kbd_set_caps_led(struct surface_hid_device *shid, bool value)
7575
rqst.length = sizeof(value_u8);
7676
rqst.payload = &value_u8;
7777

78-
return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, NULL, sizeof(value_u8));
78+
return ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, NULL, sizeof(value_u8));
7979
}
8080

8181
static int ssam_kbd_get_feature_report(struct surface_hid_device *shid, u8 *buf, size_t len)
@@ -97,7 +97,7 @@ static int ssam_kbd_get_feature_report(struct surface_hid_device *shid, u8 *buf,
9797
rsp.length = 0;
9898
rsp.pointer = buf;
9999

100-
status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(payload));
100+
status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(payload));
101101
if (status)
102102
return status;
103103

drivers/platform/surface/aggregator/bus.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ int ssam_device_add(struct ssam_device *sdev)
136136
* is always valid and can be used for requests as long as the client
137137
* device we add here is registered as child under it. This essentially
138138
* guarantees that the client driver can always expect the preconditions
139-
* for functions like ssam_request_sync (controller has to be started
140-
* and is not suspended) to hold and thus does not have to check for
141-
* them.
139+
* for functions like ssam_request_do_sync() (controller has to be
140+
* started and is not suspended) to hold and thus does not have to check
141+
* for them.
142142
*
143143
* Note that for this to work, the controller has to be a parent device.
144144
* If it is not a direct parent, care has to be taken that the device is

drivers/platform/surface/aggregator/controller.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ int ssam_request_sync_submit(struct ssam_controller *ctrl,
16741674
EXPORT_SYMBOL_GPL(ssam_request_sync_submit);
16751675

16761676
/**
1677-
* ssam_request_sync() - Execute a synchronous request.
1677+
* ssam_request_do_sync() - Execute a synchronous request.
16781678
* @ctrl: The controller via which the request will be submitted.
16791679
* @spec: The request specification and payload.
16801680
* @rsp: The response buffer.
@@ -1686,9 +1686,9 @@ EXPORT_SYMBOL_GPL(ssam_request_sync_submit);
16861686
*
16871687
* Return: Returns the status of the request or any failure during setup.
16881688
*/
1689-
int ssam_request_sync(struct ssam_controller *ctrl,
1690-
const struct ssam_request *spec,
1691-
struct ssam_response *rsp)
1689+
int ssam_request_do_sync(struct ssam_controller *ctrl,
1690+
const struct ssam_request *spec,
1691+
struct ssam_response *rsp)
16921692
{
16931693
struct ssam_request_sync *rqst;
16941694
struct ssam_span buf;
@@ -1722,10 +1722,10 @@ int ssam_request_sync(struct ssam_controller *ctrl,
17221722
ssam_request_sync_free(rqst);
17231723
return status;
17241724
}
1725-
EXPORT_SYMBOL_GPL(ssam_request_sync);
1725+
EXPORT_SYMBOL_GPL(ssam_request_do_sync);
17261726

17271727
/**
1728-
* ssam_request_sync_with_buffer() - Execute a synchronous request with the
1728+
* ssam_request_do_sync_with_buffer() - Execute a synchronous request with the
17291729
* provided buffer as back-end for the message buffer.
17301730
* @ctrl: The controller via which the request will be submitted.
17311731
* @spec: The request specification and payload.
@@ -1738,17 +1738,17 @@ EXPORT_SYMBOL_GPL(ssam_request_sync);
17381738
* SSH_COMMAND_MESSAGE_LENGTH() macro can be used to compute the required
17391739
* message buffer size.
17401740
*
1741-
* This function does essentially the same as ssam_request_sync(), but instead
1742-
* of dynamically allocating the request and message data buffer, it uses the
1743-
* provided message data buffer and stores the (small) request struct on the
1744-
* heap.
1741+
* This function does essentially the same as ssam_request_do_sync(), but
1742+
* instead of dynamically allocating the request and message data buffer, it
1743+
* uses the provided message data buffer and stores the (small) request struct
1744+
* on the heap.
17451745
*
17461746
* Return: Returns the status of the request or any failure during setup.
17471747
*/
1748-
int ssam_request_sync_with_buffer(struct ssam_controller *ctrl,
1749-
const struct ssam_request *spec,
1750-
struct ssam_response *rsp,
1751-
struct ssam_span *buf)
1748+
int ssam_request_do_sync_with_buffer(struct ssam_controller *ctrl,
1749+
const struct ssam_request *spec,
1750+
struct ssam_response *rsp,
1751+
struct ssam_span *buf)
17521752
{
17531753
struct ssam_request_sync rqst;
17541754
ssize_t len;
@@ -1772,7 +1772,7 @@ int ssam_request_sync_with_buffer(struct ssam_controller *ctrl,
17721772

17731773
return status;
17741774
}
1775-
EXPORT_SYMBOL_GPL(ssam_request_sync_with_buffer);
1775+
EXPORT_SYMBOL_GPL(ssam_request_do_sync_with_buffer);
17761776

17771777

17781778
/* -- Internal SAM requests. ------------------------------------------------ */
@@ -1864,7 +1864,7 @@ static int __ssam_ssh_event_request(struct ssam_controller *ctrl,
18641864
result.length = 0;
18651865
result.pointer = &buf;
18661866

1867-
status = ssam_retry(ssam_request_sync_onstack, ctrl, &rqst, &result,
1867+
status = ssam_retry(ssam_request_do_sync_onstack, ctrl, &rqst, &result,
18681868
sizeof(params));
18691869

18701870
return status < 0 ? status : buf;

drivers/platform/surface/surface_acpi_notify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static acpi_status san_rqst(struct san_data *d, struct gsb_buffer *buffer)
590590
return san_rqst_fixup_suspended(d, &rqst, buffer);
591591
}
592592

593-
status = __ssam_retry(ssam_request_sync_onstack, SAN_REQUEST_NUM_TRIES,
593+
status = __ssam_retry(ssam_request_do_sync_onstack, SAN_REQUEST_NUM_TRIES,
594594
d->ctrl, &rqst, &rsp, SAN_GSB_MAX_RQSX_PAYLOAD);
595595

596596
if (!status) {

drivers/platform/surface/surface_aggregator_cdev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ static long ssam_cdev_request(struct ssam_cdev_client *client, struct ssam_cdev_
302302
* theoretical maximum (SSH_COMMAND_MAX_PAYLOAD_SIZE) of the
303303
* underlying protocol (note that nothing remotely this size
304304
* should ever be allocated in any normal case). This size is
305-
* validated later in ssam_request_sync(), for allocation the
306-
* bound imposed by u16 should be enough.
305+
* validated later in ssam_request_do_sync(), for allocation
306+
* the bound imposed by u16 should be enough.
307307
*/
308308
spec.payload = kzalloc(spec.length, GFP_KERNEL);
309309
if (!spec.payload) {
@@ -342,7 +342,7 @@ static long ssam_cdev_request(struct ssam_cdev_client *client, struct ssam_cdev_
342342
}
343343

344344
/* Perform request. */
345-
status = ssam_request_sync(client->cdev->ctrl, &spec, &rsp);
345+
status = ssam_request_do_sync(client->cdev->ctrl, &spec, &rsp);
346346
if (status)
347347
goto out;
348348

drivers/platform/surface/surface_aggregator_tabletsw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sour
387387
rsp.length = 0;
388388
rsp.pointer = (u8 *)sources;
389389

390-
status = ssam_retry(ssam_request_sync_onstack, sw->sdev->ctrl, &rqst, &rsp, 0);
390+
status = ssam_retry(ssam_request_do_sync_onstack, sw->sdev->ctrl, &rqst, &rsp, 0);
391391
if (status)
392392
return status;
393393

0 commit comments

Comments
 (0)