[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202206250711.yKiwV8qa-lkp@intel.com>
Date: Sat, 25 Jun 2022 10:59:43 +0800
From: kernel test robot <lkp@...el.com>
To: Maximilian Luz <luzmaximilian@...il.com>,
Hans de Goede <hdegoede@...hat.com>
Cc: kbuild-all@...ts.01.org, Mark Gross <markgross@...nel.org>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
Maximilian Luz <luzmaximilian@...il.com>
Subject: Re: [PATCH 2/4] platform/surface: Add KIP/POS tablet-mode switch
driver
Hi Maximilian,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20220624]
[cannot apply to linus/master platform-drivers-x86/for-next v5.19-rc3 v5.19-rc2 v5.19-rc1 v5.19-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Maximilian-Luz/platform-surface-Add-support-for-tablet-mode-switch-via-Surface-Aggregator-Module/20220625-023751
base: 2f9cb3d3bd73fc2225d66aa8fcffb632ed3eb235
config: i386-allyesconfig
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/190ffdd2194f4c5a5110d6a08f303c47e2da31ba
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Maximilian-Luz/platform-surface-Add-support-for-tablet-mode-switch-via-Surface-Aggregator-Module/20220625-023751
git checkout 190ffdd2194f4c5a5110d6a08f303c47e2da31ba
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
drivers/platform/surface/surface_aggregator_tabletsw.c: In function 'ssam_pos_get_sources_list':
>> drivers/platform/surface/surface_aggregator_tabletsw.c:373:32: error: 'SSAM_SSH_TC_POS' undeclared (first use in this function); did you mean 'SSAM_SSH_TC_PoM'?
373 | rqst.target_category = SSAM_SSH_TC_POS;
| ^~~~~~~~~~~~~~~
| SSAM_SSH_TC_PoM
drivers/platform/surface/surface_aggregator_tabletsw.c:373:32: note: each undeclared identifier is reported only once for each function it appears in
In file included from drivers/platform/surface/surface_aggregator_tabletsw.c:15:
drivers/platform/surface/surface_aggregator_tabletsw.c: In function '__ssam_pos_get_posture_for_source':
drivers/platform/surface/surface_aggregator_tabletsw.c:432:28: error: 'SSAM_SSH_TC_POS' undeclared (first use in this function); did you mean 'SSAM_SSH_TC_PoM'?
432 | .target_category = SSAM_SSH_TC_POS,
| ^~~~~~~~~~~~~~~
include/linux/surface_aggregator/controller.h:500:72: note: in definition of macro 'SSAM_DEFINE_SYNC_REQUEST_WR'
500 | struct ssam_request_spec s = (struct ssam_request_spec)spec; \
| ^~~~
drivers/platform/surface/surface_aggregator_tabletsw.c: At top level:
>> drivers/platform/surface/surface_aggregator_tabletsw.c:502:44: error: 'SSAM_SSH_TC_POS' undeclared here (not in a function); did you mean 'SSAM_SSH_TC_PoM'?
502 | .target_category = SSAM_SSH_TC_POS,
| ^~~~~~~~~~~~~~~
| SSAM_SSH_TC_PoM
vim +373 drivers/platform/surface/surface_aggregator_tabletsw.c
366
367 static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sources_list *sources)
368 {
369 struct ssam_request rqst;
370 struct ssam_response rsp;
371 int status;
372
> 373 rqst.target_category = SSAM_SSH_TC_POS;
374 rqst.target_id = 0x01;
375 rqst.command_id = 0x01;
376 rqst.instance_id = 0x00;
377 rqst.flags = SSAM_REQUEST_HAS_RESPONSE;
378 rqst.length = 0;
379 rqst.payload = NULL;
380
381 rsp.capacity = sizeof(*sources);
382 rsp.length = 0;
383 rsp.pointer = (u8 *)sources;
384
385 status = ssam_retry(ssam_request_sync_onstack, sw->sdev->ctrl, &rqst, &rsp, 0);
386 if (status)
387 return status;
388
389 /* We need at least the 'sources->count' field. */
390 if (rsp.length < sizeof(__le32)) {
391 dev_err(&sw->sdev->dev, "received source list response is too small\n");
392 return -EPROTO;
393 }
394
395 /* Make sure 'sources->count' matches with the response length. */
396 if (get_unaligned_le32(&sources->count) * sizeof(__le32) + sizeof(__le32) != rsp.length) {
397 dev_err(&sw->sdev->dev, "mismatch between number of sources and response size\n");
398 return -EPROTO;
399 }
400
401 return 0;
402 }
403
404 static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id)
405 {
406 struct ssam_sources_list sources = {};
407 int status;
408
409 status = ssam_pos_get_sources_list(sw, &sources);
410 if (status)
411 return status;
412
413 if (sources.count == 0) {
414 dev_err(&sw->sdev->dev, "no posture sources found\n");
415 return -ENODEV;
416 }
417
418 /*
419 * We currently don't know what to do with more than one posture
420 * source. At the moment, only one source seems to be used/provided.
421 * The WARN_ON() here should hopefully let us know quickly once there
422 * is a device that provides multiple sources, at which point we can
423 * then try to figure out how to handle them.
424 */
425 WARN_ON(sources.count > 1);
426
427 *source_id = get_unaligned_le32(&sources.id[0]);
428 return 0;
429 }
430
431 SSAM_DEFINE_SYNC_REQUEST_WR(__ssam_pos_get_posture_for_source, __le32, __le32, {
432 .target_category = SSAM_SSH_TC_POS,
433 .target_id = 0x01,
434 .command_id = 0x02,
435 .instance_id = 0x00,
436 });
437
438 static int ssam_pos_get_posture_for_source(struct ssam_tablet_sw *sw, u32 source_id, u32 *posture)
439 {
440 __le32 source_le = cpu_to_le32(source_id);
441 __le32 rspval_le = 0;
442 int status;
443
444 status = ssam_retry(__ssam_pos_get_posture_for_source, sw->sdev->ctrl,
445 &source_le, &rspval_le);
446 if (status)
447 return status;
448
449 *posture = le32_to_cpu(rspval_le);
450 return 0;
451 }
452
453 static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, u32 *state)
454 {
455 u32 source_id;
456 int status;
457
458 status = ssam_pos_get_source(sw, &source_id);
459 if (status) {
460 dev_err(&sw->sdev->dev, "failed to get posture source ID: %d\n", status);
461 return status;
462 }
463
464 status = ssam_pos_get_posture_for_source(sw, source_id, state);
465 if (status) {
466 dev_err(&sw->sdev->dev, "failed to get posture value for source %u: %d\n",
467 source_id, status);
468 return status;
469 }
470
471 return 0;
472 }
473
474 static u32 ssam_pos_sw_notif(struct ssam_event_notifier *nf, const struct ssam_event *event)
475 {
476 struct ssam_tablet_sw *sw = container_of(nf, struct ssam_tablet_sw, notif);
477
478 if (event->command_id != SSAM_EVENT_POS_CID_POSTURE_CHANGED)
479 return 0; /* Return "unhandled". */
480
481 if (event->length != sizeof(__le32) * 3)
482 dev_warn(&sw->sdev->dev, "unexpected payload size: %u\n", event->length);
483
484 schedule_work(&sw->update_work);
485 return SSAM_NOTIF_HANDLED;
486 }
487
488 static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = {
489 .dev = {
490 .name = "Microsoft Surface POS Tablet Mode Switch",
491 .phys = "ssam/01:26:01:00:01/input0",
492 },
493 .ops = {
494 .notify = ssam_pos_sw_notif,
495 .get_state = ssam_pos_get_posture,
496 .state_name = ssam_pos_state_name,
497 .state_is_tablet_mode = ssam_pos_state_is_tablet_mode,
498 },
499 .event = {
500 .reg = SSAM_EVENT_REGISTRY_SAM,
501 .id = {
> 502 .target_category = SSAM_SSH_TC_POS,
503 .instance = 0,
504 },
505 .mask = SSAM_EVENT_MASK_TARGET,
506 },
507 };
508
509
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (285049 bytes)
Powered by blists - more mailing lists