Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/surface: aggregator: Make SSAM_DEFINE_SYNC_REQUEST_x define static functions

The SSAM_DEFINE_SYNC_REQUEST_x() macros are intended to reduce
boiler-plate code for SSAM request definitions by defining a wrapper
function for the specified request. The client device variants of those
macros, i.e. SSAM_DEFINE_SYNC_REQUEST_CL_x() in particular rely on the
multi-device (MD) variants, e.g.:

#define SSAM_DEFINE_SYNC_REQUEST_CL_R(name, rtype, spec...) \
SSAM_DEFINE_SYNC_REQUEST_MD_R(__raw_##name, rtype, spec) \
int name(struct ssam_device *sdev, rtype *ret) \
{ \
return __raw_##name(sdev->ctrl, sdev->uid.target, \
sdev->uid.instance, ret); \
}

This now creates the problem that it is not possible to declare the
generated functions static via

static SSAM_DEFINE_SYNC_REQUEST_CL_R(...)

as this will only apply to the function defined by the multi-device
macro, i.e. SSAM_DEFINE_SYNC_REQUEST_MD_R(). Thus compiling with
`-Wmissing-prototypes' rightfully complains that there is a 'static'
keyword missing.

To solve this, make all SSAM_DEFINE_SYNC_REQUEST_x() macros define
static functions. Non-client-device macros are also changed for
consistency. In general, we expect those functions to be only used
locally in the respective drivers for the corresponding interfaces, so
having to define a wrapper function to be able to export this should be
the odd case out.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: b78b4982d763 ("platform/surface: Add platform profile driver")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20210304190524.1172197-1-luzmaximilian@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Maximilian Luz and committed by
Hans de Goede
03ee3183 b78b4982

+63 -62
+2 -2
Documentation/driver-api/surface_aggregator/client.rst
··· 248 248 249 249 .. code-block:: c 250 250 251 - int __ssam_tmp_perf_mode_set(struct ssam_controller *ctrl, const __le32 *arg); 251 + static int __ssam_tmp_perf_mode_set(struct ssam_controller *ctrl, const __le32 *arg); 252 252 253 253 executing the specified request, with the controller passed in when calling 254 254 said function. In this example, the argument is provided via the ``arg`` ··· 296 296 297 297 .. code-block:: c 298 298 299 - int ssam_bat_get_sta(struct ssam_device *sdev, __le32 *ret); 299 + static int ssam_bat_get_sta(struct ssam_device *sdev, __le32 *ret); 300 300 301 301 executing the specified request, using the device IDs and controller given 302 302 in the client device. The full list of such macros for client devices is:
+5 -5
drivers/platform/surface/aggregator/controller.c
··· 1750 1750 1751 1751 /* -- Internal SAM requests. ------------------------------------------------ */ 1752 1752 1753 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_get_firmware_version, __le32, { 1753 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_get_firmware_version, __le32, { 1754 1754 .target_category = SSAM_SSH_TC_SAM, 1755 1755 .target_id = 0x01, 1756 1756 .command_id = 0x13, 1757 1757 .instance_id = 0x00, 1758 1758 }); 1759 1759 1760 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_off, u8, { 1760 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_off, u8, { 1761 1761 .target_category = SSAM_SSH_TC_SAM, 1762 1762 .target_id = 0x01, 1763 1763 .command_id = 0x15, 1764 1764 .instance_id = 0x00, 1765 1765 }); 1766 1766 1767 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_on, u8, { 1767 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_on, u8, { 1768 1768 .target_category = SSAM_SSH_TC_SAM, 1769 1769 .target_id = 0x01, 1770 1770 .command_id = 0x16, 1771 1771 .instance_id = 0x00, 1772 1772 }); 1773 1773 1774 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_exit, u8, { 1774 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_exit, u8, { 1775 1775 .target_category = SSAM_SSH_TC_SAM, 1776 1776 .target_id = 0x01, 1777 1777 .command_id = 0x33, 1778 1778 .instance_id = 0x00, 1779 1779 }); 1780 1780 1781 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_entry, u8, { 1781 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_entry, u8, { 1782 1782 .target_category = SSAM_SSH_TC_SAM, 1783 1783 .target_id = 0x01, 1784 1784 .command_id = 0x34,
+1 -1
drivers/platform/surface/surface_aggregator_registry.c
··· 302 302 struct ssam_event_notifier notif; 303 303 }; 304 304 305 - static SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_query_opmode, u8, { 305 + SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_query_opmode, u8, { 306 306 .target_category = SSAM_SSH_TC_BAS, 307 307 .target_id = 0x01, 308 308 .command_id = 0x0d,
+2 -2
drivers/platform/surface/surface_platform_profile.c
··· 32 32 struct platform_profile_handler handler; 33 33 }; 34 34 35 - static SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_tmp_profile_get, struct ssam_tmp_profile_info, { 35 + SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_tmp_profile_get, struct ssam_tmp_profile_info, { 36 36 .target_category = SSAM_SSH_TC_TMP, 37 37 .command_id = 0x02, 38 38 }); 39 39 40 - static SSAM_DEFINE_SYNC_REQUEST_CL_W(__ssam_tmp_profile_set, __le32, { 40 + SSAM_DEFINE_SYNC_REQUEST_CL_W(__ssam_tmp_profile_set, __le32, { 41 41 .target_category = SSAM_SSH_TC_TMP, 42 42 .command_id = 0x03, 43 43 });
+37 -37
include/linux/surface_aggregator/controller.h
··· 344 344 * request has been fully completed. The required transport buffer will be 345 345 * allocated on the stack. 346 346 * 347 - * The generated function is defined as ``int name(struct ssam_controller 348 - * *ctrl)``, returning the status of the request, which is zero on success and 349 - * negative on failure. The ``ctrl`` parameter is the controller via which the 350 - * request is being sent. 347 + * The generated function is defined as ``static int name(struct 348 + * ssam_controller *ctrl)``, returning the status of the request, which is 349 + * zero on success and negative on failure. The ``ctrl`` parameter is the 350 + * controller via which the request is being sent. 351 351 * 352 352 * Refer to ssam_request_sync_onstack() for more details on the behavior of 353 353 * the generated function. 354 354 */ 355 355 #define SSAM_DEFINE_SYNC_REQUEST_N(name, spec...) \ 356 - int name(struct ssam_controller *ctrl) \ 356 + static int name(struct ssam_controller *ctrl) \ 357 357 { \ 358 358 struct ssam_request_spec s = (struct ssam_request_spec)spec; \ 359 359 struct ssam_request rqst; \ ··· 383 383 * returning once the request has been fully completed. The required transport 384 384 * buffer will be allocated on the stack. 385 385 * 386 - * The generated function is defined as ``int name(struct ssam_controller 387 - * *ctrl, const atype *arg)``, returning the status of the request, which is 388 - * zero on success and negative on failure. The ``ctrl`` parameter is the 389 - * controller via which the request is sent. The request argument is specified 390 - * via the ``arg`` pointer. 386 + * The generated function is defined as ``static int name(struct 387 + * ssam_controller *ctrl, const atype *arg)``, returning the status of the 388 + * request, which is zero on success and negative on failure. The ``ctrl`` 389 + * parameter is the controller via which the request is sent. The request 390 + * argument is specified via the ``arg`` pointer. 391 391 * 392 392 * Refer to ssam_request_sync_onstack() for more details on the behavior of 393 393 * the generated function. 394 394 */ 395 395 #define SSAM_DEFINE_SYNC_REQUEST_W(name, atype, spec...) \ 396 - int name(struct ssam_controller *ctrl, const atype *arg) \ 396 + static int name(struct ssam_controller *ctrl, const atype *arg) \ 397 397 { \ 398 398 struct ssam_request_spec s = (struct ssam_request_spec)spec; \ 399 399 struct ssam_request rqst; \ ··· 424 424 * request itself, returning once the request has been fully completed. The 425 425 * required transport buffer will be allocated on the stack. 426 426 * 427 - * The generated function is defined as ``int name(struct ssam_controller 428 - * *ctrl, rtype *ret)``, returning the status of the request, which is zero on 429 - * success and negative on failure. The ``ctrl`` parameter is the controller 430 - * via which the request is sent. The request's return value is written to the 431 - * memory pointed to by the ``ret`` parameter. 427 + * The generated function is defined as ``static int name(struct 428 + * ssam_controller *ctrl, rtype *ret)``, returning the status of the request, 429 + * which is zero on success and negative on failure. The ``ctrl`` parameter is 430 + * the controller via which the request is sent. The request's return value is 431 + * written to the memory pointed to by the ``ret`` parameter. 432 432 * 433 433 * Refer to ssam_request_sync_onstack() for more details on the behavior of 434 434 * the generated function. 435 435 */ 436 436 #define SSAM_DEFINE_SYNC_REQUEST_R(name, rtype, spec...) \ 437 - int name(struct ssam_controller *ctrl, rtype *ret) \ 437 + static int name(struct ssam_controller *ctrl, rtype *ret) \ 438 438 { \ 439 439 struct ssam_request_spec s = (struct ssam_request_spec)spec; \ 440 440 struct ssam_request rqst; \ ··· 483 483 * returning once the request has been fully completed. The required transport 484 484 * buffer will be allocated on the stack. 485 485 * 486 - * The generated function is defined as ``int name(struct ssam_controller 487 - * *ctrl, u8 tid, u8 iid)``, returning the status of the request, which is 488 - * zero on success and negative on failure. The ``ctrl`` parameter is the 489 - * controller via which the request is sent, ``tid`` the target ID for the 490 - * request, and ``iid`` the instance ID. 486 + * The generated function is defined as ``static int name(struct 487 + * ssam_controller *ctrl, u8 tid, u8 iid)``, returning the status of the 488 + * request, which is zero on success and negative on failure. The ``ctrl`` 489 + * parameter is the controller via which the request is sent, ``tid`` the 490 + * target ID for the request, and ``iid`` the instance ID. 491 491 * 492 492 * Refer to ssam_request_sync_onstack() for more details on the behavior of 493 493 * the generated function. 494 494 */ 495 495 #define SSAM_DEFINE_SYNC_REQUEST_MD_N(name, spec...) \ 496 - int name(struct ssam_controller *ctrl, u8 tid, u8 iid) \ 496 + static int name(struct ssam_controller *ctrl, u8 tid, u8 iid) \ 497 497 { \ 498 498 struct ssam_request_spec_md s = (struct ssam_request_spec_md)spec; \ 499 499 struct ssam_request rqst; \ ··· 524 524 * the request itself, returning once the request has been fully completed. 525 525 * The required transport buffer will be allocated on the stack. 526 526 * 527 - * The generated function is defined as ``int name(struct ssam_controller 528 - * *ctrl, u8 tid, u8 iid, const atype *arg)``, returning the status of the 529 - * request, which is zero on success and negative on failure. The ``ctrl`` 530 - * parameter is the controller via which the request is sent, ``tid`` the 531 - * target ID for the request, and ``iid`` the instance ID. The request argument 532 - * is specified via the ``arg`` pointer. 527 + * The generated function is defined as ``static int name(struct 528 + * ssam_controller *ctrl, u8 tid, u8 iid, const atype *arg)``, returning the 529 + * status of the request, which is zero on success and negative on failure. 530 + * The ``ctrl`` parameter is the controller via which the request is sent, 531 + * ``tid`` the target ID for the request, and ``iid`` the instance ID. The 532 + * request argument is specified via the ``arg`` pointer. 533 533 * 534 534 * Refer to ssam_request_sync_onstack() for more details on the behavior of 535 535 * the generated function. 536 536 */ 537 537 #define SSAM_DEFINE_SYNC_REQUEST_MD_W(name, atype, spec...) \ 538 - int name(struct ssam_controller *ctrl, u8 tid, u8 iid, const atype *arg)\ 538 + static int name(struct ssam_controller *ctrl, u8 tid, u8 iid, const atype *arg) \ 539 539 { \ 540 540 struct ssam_request_spec_md s = (struct ssam_request_spec_md)spec; \ 541 541 struct ssam_request rqst; \ ··· 567 567 * execution of the request itself, returning once the request has been fully 568 568 * completed. The required transport buffer will be allocated on the stack. 569 569 * 570 - * The generated function is defined as ``int name(struct ssam_controller 571 - * *ctrl, u8 tid, u8 iid, rtype *ret)``, returning the status of the request, 572 - * which is zero on success and negative on failure. The ``ctrl`` parameter is 573 - * the controller via which the request is sent, ``tid`` the target ID for the 574 - * request, and ``iid`` the instance ID. The request's return value is written 575 - * to the memory pointed to by the ``ret`` parameter. 570 + * The generated function is defined as ``static int name(struct 571 + * ssam_controller *ctrl, u8 tid, u8 iid, rtype *ret)``, returning the status 572 + * of the request, which is zero on success and negative on failure. The 573 + * ``ctrl`` parameter is the controller via which the request is sent, ``tid`` 574 + * the target ID for the request, and ``iid`` the instance ID. The request's 575 + * return value is written to the memory pointed to by the ``ret`` parameter. 576 576 * 577 577 * Refer to ssam_request_sync_onstack() for more details on the behavior of 578 578 * the generated function. 579 579 */ 580 580 #define SSAM_DEFINE_SYNC_REQUEST_MD_R(name, rtype, spec...) \ 581 - int name(struct ssam_controller *ctrl, u8 tid, u8 iid, rtype *ret) \ 581 + static int name(struct ssam_controller *ctrl, u8 tid, u8 iid, rtype *ret) \ 582 582 { \ 583 583 struct ssam_request_spec_md s = (struct ssam_request_spec_md)spec; \ 584 584 struct ssam_request rqst; \
+16 -15
include/linux/surface_aggregator/device.h
··· 336 336 * request has been fully completed. The required transport buffer will be 337 337 * allocated on the stack. 338 338 * 339 - * The generated function is defined as ``int name(struct ssam_device *sdev)``, 340 - * returning the status of the request, which is zero on success and negative 341 - * on failure. The ``sdev`` parameter specifies both the target device of the 342 - * request and by association the controller via which the request is sent. 339 + * The generated function is defined as ``static int name(struct ssam_device 340 + * *sdev)``, returning the status of the request, which is zero on success and 341 + * negative on failure. The ``sdev`` parameter specifies both the target 342 + * device of the request and by association the controller via which the 343 + * request is sent. 343 344 * 344 345 * Refer to ssam_request_sync_onstack() for more details on the behavior of 345 346 * the generated function. 346 347 */ 347 348 #define SSAM_DEFINE_SYNC_REQUEST_CL_N(name, spec...) \ 348 349 SSAM_DEFINE_SYNC_REQUEST_MD_N(__raw_##name, spec) \ 349 - int name(struct ssam_device *sdev) \ 350 + static int name(struct ssam_device *sdev) \ 350 351 { \ 351 352 return __raw_##name(sdev->ctrl, sdev->uid.target, \ 352 353 sdev->uid.instance); \ ··· 369 368 * itself, returning once the request has been fully completed. The required 370 369 * transport buffer will be allocated on the stack. 371 370 * 372 - * The generated function is defined as ``int name(struct ssam_device *sdev, 373 - * const atype *arg)``, returning the status of the request, which is zero on 374 - * success and negative on failure. The ``sdev`` parameter specifies both the 375 - * target device of the request and by association the controller via which 376 - * the request is sent. The request's argument is specified via the ``arg`` 377 - * pointer. 371 + * The generated function is defined as ``static int name(struct ssam_device 372 + * *sdev, const atype *arg)``, returning the status of the request, which is 373 + * zero on success and negative on failure. The ``sdev`` parameter specifies 374 + * both the target device of the request and by association the controller via 375 + * which the request is sent. The request's argument is specified via the 376 + * ``arg`` pointer. 378 377 * 379 378 * Refer to ssam_request_sync_onstack() for more details on the behavior of 380 379 * the generated function. 381 380 */ 382 381 #define SSAM_DEFINE_SYNC_REQUEST_CL_W(name, atype, spec...) \ 383 382 SSAM_DEFINE_SYNC_REQUEST_MD_W(__raw_##name, atype, spec) \ 384 - int name(struct ssam_device *sdev, const atype *arg) \ 383 + static int name(struct ssam_device *sdev, const atype *arg) \ 385 384 { \ 386 385 return __raw_##name(sdev->ctrl, sdev->uid.target, \ 387 386 sdev->uid.instance, arg); \ ··· 403 402 * itself, returning once the request has been fully completed. The required 404 403 * transport buffer will be allocated on the stack. 405 404 * 406 - * The generated function is defined as ``int name(struct ssam_device *sdev, 407 - * rtype *ret)``, returning the status of the request, which is zero on 405 + * The generated function is defined as ``static int name(struct ssam_device 406 + * *sdev, rtype *ret)``, returning the status of the request, which is zero on 408 407 * success and negative on failure. The ``sdev`` parameter specifies both the 409 408 * target device of the request and by association the controller via which 410 409 * the request is sent. The request's return value is written to the memory ··· 415 414 */ 416 415 #define SSAM_DEFINE_SYNC_REQUEST_CL_R(name, rtype, spec...) \ 417 416 SSAM_DEFINE_SYNC_REQUEST_MD_R(__raw_##name, rtype, spec) \ 418 - int name(struct ssam_device *sdev, rtype *ret) \ 417 + static int name(struct ssam_device *sdev, rtype *ret) \ 419 418 { \ 420 419 return __raw_##name(sdev->ctrl, sdev->uid.target, \ 421 420 sdev->uid.instance, ret); \