* drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
@ 2022-08-09 18:48 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-08-09 18:48 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10628 bytes --]
BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Dustin L. Howett" <dustin@howett.net>
CC: "Tzung-Bi Shih" <tzungbi@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 426b4ca2d6a5ab51f6b6175d06e4f8ddea434cdf
commit: c9bc1a0ef9f613a7bc1adfff4c67dc5e5d7d1709 platform/chrome: cros_ec_lpcs: reserve the MEC LPC I/O ports first
date: 3 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 3 months ago
config: i386-randconfig-m021-20220808 (https://download.01.org/0day-ci/archive/20220810/202208100209.YVz4IYFb-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
vim +382 drivers/platform/chrome/cros_ec_lpc.c
a6df7798d03b29 Gwendal Grignou 2017-05-16 334
ec2f33ab582bf6 Bill Richardson 2015-02-02 335 static int cros_ec_lpc_probe(struct platform_device *pdev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 336 {
ec2f33ab582bf6 Bill Richardson 2015-02-02 337 struct device *dev = &pdev->dev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 338 struct acpi_device *adev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 339 acpi_status status;
ec2f33ab582bf6 Bill Richardson 2015-02-02 340 struct cros_ec_device *ec_dev;
bce70fef727924 Shawn Nematbakhsh 2017-05-16 341 u8 buf[2];
da1cf5a1cf124f Enrico Granata 2018-10-09 342 int irq, ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 343
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 344 /*
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 345 * The Framework Laptop (and possibly other non-ChromeOS devices)
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 346 * only exposes the eight I/O ports that are required for the Microchip EC.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 347 * Requesting a larger reservation will fail.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 348 */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 349 if (!devm_request_region(dev, EC_HOST_CMD_REGION0,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 350 EC_HOST_CMD_MEC_REGION_SIZE, dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 351 dev_err(dev, "couldn't reserve MEC region\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 352 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 353 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 354
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 355 /*
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 356 * Read the mapped ID twice, the first one is assuming the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 357 * EC is a Microchip Embedded Controller (MEC) variant, if the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 358 * protocol fails, fallback to the non MEC variant and try to
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 359 * read again the ID.
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 360 */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 361 cros_ec_lpc_ops.read = cros_ec_lpc_mec_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 362 cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 363 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 364 if (buf[0] != 'E' || buf[1] != 'C') {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 365 if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 366 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 367 dev_err(dev, "couldn't reserve memmap region\n");
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 368 return -EBUSY;
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 369 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 370
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 371 /* Re-assign read/write operations for the non MEC variant */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 372 cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 373 cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 374 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2,
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 375 buf);
bce70fef727924 Shawn Nematbakhsh 2017-05-16 376 if (buf[0] != 'E' || buf[1] != 'C') {
ec2f33ab582bf6 Bill Richardson 2015-02-02 377 dev_err(dev, "EC ID not detected\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 378 return -ENODEV;
ec2f33ab582bf6 Bill Richardson 2015-02-02 379 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 380
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 381 /* Reserve the remaining I/O ports required by the non-MEC protocol. */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 @382 if (!devm_request_region(dev, EC_HOST_CMD_REGION0 + EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 383 EC_HOST_CMD_REGION_SIZE - EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 384 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 385 dev_err(dev, "couldn't reserve remainder of region0\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 386 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 387 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 388 if (!devm_request_region(dev, EC_HOST_CMD_REGION1,
ec2f33ab582bf6 Bill Richardson 2015-02-02 389 EC_HOST_CMD_REGION_SIZE, dev_name(dev))) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 390 dev_err(dev, "couldn't reserve region1\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 391 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 392 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 393 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 394
ec2f33ab582bf6 Bill Richardson 2015-02-02 395 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
ec2f33ab582bf6 Bill Richardson 2015-02-02 396 if (!ec_dev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 397 return -ENOMEM;
ec2f33ab582bf6 Bill Richardson 2015-02-02 398
ec2f33ab582bf6 Bill Richardson 2015-02-02 399 platform_set_drvdata(pdev, ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 400 ec_dev->dev = dev;
ec2f33ab582bf6 Bill Richardson 2015-02-02 401 ec_dev->phys_name = dev_name(dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 402 ec_dev->cmd_xfer = cros_ec_cmd_xfer_lpc;
d365407079d331 Stephen Barber 2015-06-09 403 ec_dev->pkt_xfer = cros_ec_pkt_xfer_lpc;
ec2f33ab582bf6 Bill Richardson 2015-02-02 404 ec_dev->cmd_readmem = cros_ec_lpc_readmem;
2c7589af3c4dee Stephen Barber 2015-06-09 405 ec_dev->din_size = sizeof(struct ec_host_response) +
2c7589af3c4dee Stephen Barber 2015-06-09 406 sizeof(struct ec_response_get_protocol_info);
2c7589af3c4dee Stephen Barber 2015-06-09 407 ec_dev->dout_size = sizeof(struct ec_host_request);
ec2f33ab582bf6 Bill Richardson 2015-02-02 408
da1cf5a1cf124f Enrico Granata 2018-10-09 409 /*
da1cf5a1cf124f Enrico Granata 2018-10-09 410 * Some boards do not have an IRQ allotted for cros_ec_lpc,
da1cf5a1cf124f Enrico Granata 2018-10-09 411 * which makes ENXIO an expected (and safe) scenario.
da1cf5a1cf124f Enrico Granata 2018-10-09 412 */
a69b4eebe513b8 Enric Balletbo i Serra 2019-11-29 413 irq = platform_get_irq_optional(pdev, 0);
da1cf5a1cf124f Enrico Granata 2018-10-09 414 if (irq > 0)
da1cf5a1cf124f Enrico Granata 2018-10-09 415 ec_dev->irq = irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 416 else if (irq != -ENXIO) {
da1cf5a1cf124f Enrico Granata 2018-10-09 417 dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
da1cf5a1cf124f Enrico Granata 2018-10-09 418 return irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 419 }
da1cf5a1cf124f Enrico Granata 2018-10-09 420
ec2f33ab582bf6 Bill Richardson 2015-02-02 421 ret = cros_ec_register(ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 422 if (ret) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 423 dev_err(dev, "couldn't register ec_dev (%d)\n", ret);
ec2f33ab582bf6 Bill Richardson 2015-02-02 424 return ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 425 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 426
a6df7798d03b29 Gwendal Grignou 2017-05-16 427 /*
a6df7798d03b29 Gwendal Grignou 2017-05-16 428 * Connect a notify handler to process MKBP messages if we have a
a6df7798d03b29 Gwendal Grignou 2017-05-16 429 * companion ACPI device.
a6df7798d03b29 Gwendal Grignou 2017-05-16 430 */
a6df7798d03b29 Gwendal Grignou 2017-05-16 431 adev = ACPI_COMPANION(dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 432 if (adev) {
a6df7798d03b29 Gwendal Grignou 2017-05-16 433 status = acpi_install_notify_handler(adev->handle,
a6df7798d03b29 Gwendal Grignou 2017-05-16 434 ACPI_ALL_NOTIFY,
a6df7798d03b29 Gwendal Grignou 2017-05-16 435 cros_ec_lpc_acpi_notify,
a6df7798d03b29 Gwendal Grignou 2017-05-16 436 ec_dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 437 if (ACPI_FAILURE(status))
a6df7798d03b29 Gwendal Grignou 2017-05-16 438 dev_warn(dev, "Failed to register notifier %08x\n",
a6df7798d03b29 Gwendal Grignou 2017-05-16 439 status);
a6df7798d03b29 Gwendal Grignou 2017-05-16 440 }
a6df7798d03b29 Gwendal Grignou 2017-05-16 441
ec2f33ab582bf6 Bill Richardson 2015-02-02 442 return 0;
ec2f33ab582bf6 Bill Richardson 2015-02-02 443 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 444
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
@ 2022-08-10 19:30 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-08-10 19:30 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10631 bytes --]
BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Dustin L. Howett" <dustin@howett.net>
CC: "Tzung-Bi Shih" <tzungbi@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f41445645ab5d172e6090d00c332c335d8dba337
commit: c9bc1a0ef9f613a7bc1adfff4c67dc5e5d7d1709 platform/chrome: cros_ec_lpcs: reserve the MEC LPC I/O ports first
date: 3 months ago
:::::: branch date: 53 minutes ago
:::::: commit date: 3 months ago
config: i386-randconfig-m021-20220808 (https://download.01.org/0day-ci/archive/20220811/202208110349.IluaEBSD-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
vim +382 drivers/platform/chrome/cros_ec_lpc.c
a6df7798d03b29 Gwendal Grignou 2017-05-16 334
ec2f33ab582bf6 Bill Richardson 2015-02-02 335 static int cros_ec_lpc_probe(struct platform_device *pdev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 336 {
ec2f33ab582bf6 Bill Richardson 2015-02-02 337 struct device *dev = &pdev->dev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 338 struct acpi_device *adev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 339 acpi_status status;
ec2f33ab582bf6 Bill Richardson 2015-02-02 340 struct cros_ec_device *ec_dev;
bce70fef727924 Shawn Nematbakhsh 2017-05-16 341 u8 buf[2];
da1cf5a1cf124f Enrico Granata 2018-10-09 342 int irq, ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 343
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 344 /*
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 345 * The Framework Laptop (and possibly other non-ChromeOS devices)
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 346 * only exposes the eight I/O ports that are required for the Microchip EC.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 347 * Requesting a larger reservation will fail.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 348 */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 349 if (!devm_request_region(dev, EC_HOST_CMD_REGION0,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 350 EC_HOST_CMD_MEC_REGION_SIZE, dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 351 dev_err(dev, "couldn't reserve MEC region\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 352 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 353 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 354
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 355 /*
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 356 * Read the mapped ID twice, the first one is assuming the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 357 * EC is a Microchip Embedded Controller (MEC) variant, if the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 358 * protocol fails, fallback to the non MEC variant and try to
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 359 * read again the ID.
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 360 */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 361 cros_ec_lpc_ops.read = cros_ec_lpc_mec_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 362 cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 363 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 364 if (buf[0] != 'E' || buf[1] != 'C') {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 365 if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 366 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 367 dev_err(dev, "couldn't reserve memmap region\n");
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 368 return -EBUSY;
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 369 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 370
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 371 /* Re-assign read/write operations for the non MEC variant */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 372 cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 373 cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 374 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2,
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 375 buf);
bce70fef727924 Shawn Nematbakhsh 2017-05-16 376 if (buf[0] != 'E' || buf[1] != 'C') {
ec2f33ab582bf6 Bill Richardson 2015-02-02 377 dev_err(dev, "EC ID not detected\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 378 return -ENODEV;
ec2f33ab582bf6 Bill Richardson 2015-02-02 379 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 380
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 381 /* Reserve the remaining I/O ports required by the non-MEC protocol. */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 @382 if (!devm_request_region(dev, EC_HOST_CMD_REGION0 + EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 383 EC_HOST_CMD_REGION_SIZE - EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 384 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 385 dev_err(dev, "couldn't reserve remainder of region0\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 386 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 387 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 388 if (!devm_request_region(dev, EC_HOST_CMD_REGION1,
ec2f33ab582bf6 Bill Richardson 2015-02-02 389 EC_HOST_CMD_REGION_SIZE, dev_name(dev))) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 390 dev_err(dev, "couldn't reserve region1\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 391 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 392 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 393 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 394
ec2f33ab582bf6 Bill Richardson 2015-02-02 395 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
ec2f33ab582bf6 Bill Richardson 2015-02-02 396 if (!ec_dev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 397 return -ENOMEM;
ec2f33ab582bf6 Bill Richardson 2015-02-02 398
ec2f33ab582bf6 Bill Richardson 2015-02-02 399 platform_set_drvdata(pdev, ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 400 ec_dev->dev = dev;
ec2f33ab582bf6 Bill Richardson 2015-02-02 401 ec_dev->phys_name = dev_name(dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 402 ec_dev->cmd_xfer = cros_ec_cmd_xfer_lpc;
d365407079d331 Stephen Barber 2015-06-09 403 ec_dev->pkt_xfer = cros_ec_pkt_xfer_lpc;
ec2f33ab582bf6 Bill Richardson 2015-02-02 404 ec_dev->cmd_readmem = cros_ec_lpc_readmem;
2c7589af3c4dee Stephen Barber 2015-06-09 405 ec_dev->din_size = sizeof(struct ec_host_response) +
2c7589af3c4dee Stephen Barber 2015-06-09 406 sizeof(struct ec_response_get_protocol_info);
2c7589af3c4dee Stephen Barber 2015-06-09 407 ec_dev->dout_size = sizeof(struct ec_host_request);
ec2f33ab582bf6 Bill Richardson 2015-02-02 408
da1cf5a1cf124f Enrico Granata 2018-10-09 409 /*
da1cf5a1cf124f Enrico Granata 2018-10-09 410 * Some boards do not have an IRQ allotted for cros_ec_lpc,
da1cf5a1cf124f Enrico Granata 2018-10-09 411 * which makes ENXIO an expected (and safe) scenario.
da1cf5a1cf124f Enrico Granata 2018-10-09 412 */
a69b4eebe513b8 Enric Balletbo i Serra 2019-11-29 413 irq = platform_get_irq_optional(pdev, 0);
da1cf5a1cf124f Enrico Granata 2018-10-09 414 if (irq > 0)
da1cf5a1cf124f Enrico Granata 2018-10-09 415 ec_dev->irq = irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 416 else if (irq != -ENXIO) {
da1cf5a1cf124f Enrico Granata 2018-10-09 417 dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
da1cf5a1cf124f Enrico Granata 2018-10-09 418 return irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 419 }
da1cf5a1cf124f Enrico Granata 2018-10-09 420
ec2f33ab582bf6 Bill Richardson 2015-02-02 421 ret = cros_ec_register(ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 422 if (ret) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 423 dev_err(dev, "couldn't register ec_dev (%d)\n", ret);
ec2f33ab582bf6 Bill Richardson 2015-02-02 424 return ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 425 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 426
a6df7798d03b29 Gwendal Grignou 2017-05-16 427 /*
a6df7798d03b29 Gwendal Grignou 2017-05-16 428 * Connect a notify handler to process MKBP messages if we have a
a6df7798d03b29 Gwendal Grignou 2017-05-16 429 * companion ACPI device.
a6df7798d03b29 Gwendal Grignou 2017-05-16 430 */
a6df7798d03b29 Gwendal Grignou 2017-05-16 431 adev = ACPI_COMPANION(dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 432 if (adev) {
a6df7798d03b29 Gwendal Grignou 2017-05-16 433 status = acpi_install_notify_handler(adev->handle,
a6df7798d03b29 Gwendal Grignou 2017-05-16 434 ACPI_ALL_NOTIFY,
a6df7798d03b29 Gwendal Grignou 2017-05-16 435 cros_ec_lpc_acpi_notify,
a6df7798d03b29 Gwendal Grignou 2017-05-16 436 ec_dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 437 if (ACPI_FAILURE(status))
a6df7798d03b29 Gwendal Grignou 2017-05-16 438 dev_warn(dev, "Failed to register notifier %08x\n",
a6df7798d03b29 Gwendal Grignou 2017-05-16 439 status);
a6df7798d03b29 Gwendal Grignou 2017-05-16 440 }
a6df7798d03b29 Gwendal Grignou 2017-05-16 441
ec2f33ab582bf6 Bill Richardson 2015-02-02 442 return 0;
ec2f33ab582bf6 Bill Richardson 2015-02-02 443 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 444
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
@ 2022-06-20 12:45 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-20 12:45 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10627 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Dustin L. Howett" <dustin@howett.net>
CC: "Tzung-Bi Shih" <tzungbi@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b35035bcf80ddb47c0112c4fbd84a63a2836a18
commit: c9bc1a0ef9f613a7bc1adfff4c67dc5e5d7d1709 platform/chrome: cros_ec_lpcs: reserve the MEC LPC I/O ports first
date: 7 weeks ago
:::::: branch date: 3 days ago
:::::: commit date: 7 weeks ago
config: x86_64-randconfig-m001-20220620 (https://download.01.org/0day-ci/archive/20220620/202206202040.NN89l1Y7-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
vim +382 drivers/platform/chrome/cros_ec_lpc.c
a6df7798d03b29 Gwendal Grignou 2017-05-16 334
ec2f33ab582bf6 Bill Richardson 2015-02-02 335 static int cros_ec_lpc_probe(struct platform_device *pdev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 336 {
ec2f33ab582bf6 Bill Richardson 2015-02-02 337 struct device *dev = &pdev->dev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 338 struct acpi_device *adev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 339 acpi_status status;
ec2f33ab582bf6 Bill Richardson 2015-02-02 340 struct cros_ec_device *ec_dev;
bce70fef727924 Shawn Nematbakhsh 2017-05-16 341 u8 buf[2];
da1cf5a1cf124f Enrico Granata 2018-10-09 342 int irq, ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 343
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 344 /*
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 345 * The Framework Laptop (and possibly other non-ChromeOS devices)
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 346 * only exposes the eight I/O ports that are required for the Microchip EC.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 347 * Requesting a larger reservation will fail.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 348 */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 349 if (!devm_request_region(dev, EC_HOST_CMD_REGION0,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 350 EC_HOST_CMD_MEC_REGION_SIZE, dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 351 dev_err(dev, "couldn't reserve MEC region\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 352 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 353 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 354
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 355 /*
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 356 * Read the mapped ID twice, the first one is assuming the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 357 * EC is a Microchip Embedded Controller (MEC) variant, if the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 358 * protocol fails, fallback to the non MEC variant and try to
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 359 * read again the ID.
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 360 */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 361 cros_ec_lpc_ops.read = cros_ec_lpc_mec_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 362 cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 363 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 364 if (buf[0] != 'E' || buf[1] != 'C') {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 365 if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 366 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 367 dev_err(dev, "couldn't reserve memmap region\n");
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 368 return -EBUSY;
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 369 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 370
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 371 /* Re-assign read/write operations for the non MEC variant */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 372 cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 373 cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 374 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2,
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 375 buf);
bce70fef727924 Shawn Nematbakhsh 2017-05-16 376 if (buf[0] != 'E' || buf[1] != 'C') {
ec2f33ab582bf6 Bill Richardson 2015-02-02 377 dev_err(dev, "EC ID not detected\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 378 return -ENODEV;
ec2f33ab582bf6 Bill Richardson 2015-02-02 379 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 380
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 381 /* Reserve the remaining I/O ports required by the non-MEC protocol. */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 @382 if (!devm_request_region(dev, EC_HOST_CMD_REGION0 + EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 383 EC_HOST_CMD_REGION_SIZE - EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 384 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 385 dev_err(dev, "couldn't reserve remainder of region0\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 386 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 387 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 388 if (!devm_request_region(dev, EC_HOST_CMD_REGION1,
ec2f33ab582bf6 Bill Richardson 2015-02-02 389 EC_HOST_CMD_REGION_SIZE, dev_name(dev))) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 390 dev_err(dev, "couldn't reserve region1\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 391 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 392 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 393 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 394
ec2f33ab582bf6 Bill Richardson 2015-02-02 395 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
ec2f33ab582bf6 Bill Richardson 2015-02-02 396 if (!ec_dev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 397 return -ENOMEM;
ec2f33ab582bf6 Bill Richardson 2015-02-02 398
ec2f33ab582bf6 Bill Richardson 2015-02-02 399 platform_set_drvdata(pdev, ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 400 ec_dev->dev = dev;
ec2f33ab582bf6 Bill Richardson 2015-02-02 401 ec_dev->phys_name = dev_name(dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 402 ec_dev->cmd_xfer = cros_ec_cmd_xfer_lpc;
d365407079d331 Stephen Barber 2015-06-09 403 ec_dev->pkt_xfer = cros_ec_pkt_xfer_lpc;
ec2f33ab582bf6 Bill Richardson 2015-02-02 404 ec_dev->cmd_readmem = cros_ec_lpc_readmem;
2c7589af3c4dee Stephen Barber 2015-06-09 405 ec_dev->din_size = sizeof(struct ec_host_response) +
2c7589af3c4dee Stephen Barber 2015-06-09 406 sizeof(struct ec_response_get_protocol_info);
2c7589af3c4dee Stephen Barber 2015-06-09 407 ec_dev->dout_size = sizeof(struct ec_host_request);
ec2f33ab582bf6 Bill Richardson 2015-02-02 408
da1cf5a1cf124f Enrico Granata 2018-10-09 409 /*
da1cf5a1cf124f Enrico Granata 2018-10-09 410 * Some boards do not have an IRQ allotted for cros_ec_lpc,
da1cf5a1cf124f Enrico Granata 2018-10-09 411 * which makes ENXIO an expected (and safe) scenario.
da1cf5a1cf124f Enrico Granata 2018-10-09 412 */
a69b4eebe513b8 Enric Balletbo i Serra 2019-11-29 413 irq = platform_get_irq_optional(pdev, 0);
da1cf5a1cf124f Enrico Granata 2018-10-09 414 if (irq > 0)
da1cf5a1cf124f Enrico Granata 2018-10-09 415 ec_dev->irq = irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 416 else if (irq != -ENXIO) {
da1cf5a1cf124f Enrico Granata 2018-10-09 417 dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
da1cf5a1cf124f Enrico Granata 2018-10-09 418 return irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 419 }
da1cf5a1cf124f Enrico Granata 2018-10-09 420
ec2f33ab582bf6 Bill Richardson 2015-02-02 421 ret = cros_ec_register(ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 422 if (ret) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 423 dev_err(dev, "couldn't register ec_dev (%d)\n", ret);
ec2f33ab582bf6 Bill Richardson 2015-02-02 424 return ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 425 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 426
a6df7798d03b29 Gwendal Grignou 2017-05-16 427 /*
a6df7798d03b29 Gwendal Grignou 2017-05-16 428 * Connect a notify handler to process MKBP messages if we have a
a6df7798d03b29 Gwendal Grignou 2017-05-16 429 * companion ACPI device.
a6df7798d03b29 Gwendal Grignou 2017-05-16 430 */
a6df7798d03b29 Gwendal Grignou 2017-05-16 431 adev = ACPI_COMPANION(dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 432 if (adev) {
a6df7798d03b29 Gwendal Grignou 2017-05-16 433 status = acpi_install_notify_handler(adev->handle,
a6df7798d03b29 Gwendal Grignou 2017-05-16 434 ACPI_ALL_NOTIFY,
a6df7798d03b29 Gwendal Grignou 2017-05-16 435 cros_ec_lpc_acpi_notify,
a6df7798d03b29 Gwendal Grignou 2017-05-16 436 ec_dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 437 if (ACPI_FAILURE(status))
a6df7798d03b29 Gwendal Grignou 2017-05-16 438 dev_warn(dev, "Failed to register notifier %08x\n",
a6df7798d03b29 Gwendal Grignou 2017-05-16 439 status);
a6df7798d03b29 Gwendal Grignou 2017-05-16 440 }
a6df7798d03b29 Gwendal Grignou 2017-05-16 441
ec2f33ab582bf6 Bill Richardson 2015-02-02 442 return 0;
ec2f33ab582bf6 Bill Richardson 2015-02-02 443 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 444
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
@ 2022-06-17 9:20 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-17 9:20 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10622 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: "Dustin L. Howett" <dustin@howett.net>
CC: "Tzung-Bi Shih" <tzungbi@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 47700948a4abb4a5ae13ef943ff682a7f327547a
commit: c9bc1a0ef9f613a7bc1adfff4c67dc5e5d7d1709 platform/chrome: cros_ec_lpcs: reserve the MEC LPC I/O ports first
date: 6 weeks ago
:::::: branch date: 5 hours ago
:::::: commit date: 6 weeks ago
config: ia64-randconfig-m031-20220617 (https://download.01.org/0day-ci/archive/20220617/202206171714.8BBFqjqg-lkp(a)intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here
vim +382 drivers/platform/chrome/cros_ec_lpc.c
a6df7798d03b29 Gwendal Grignou 2017-05-16 334
ec2f33ab582bf6 Bill Richardson 2015-02-02 335 static int cros_ec_lpc_probe(struct platform_device *pdev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 336 {
ec2f33ab582bf6 Bill Richardson 2015-02-02 337 struct device *dev = &pdev->dev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 338 struct acpi_device *adev;
a6df7798d03b29 Gwendal Grignou 2017-05-16 339 acpi_status status;
ec2f33ab582bf6 Bill Richardson 2015-02-02 340 struct cros_ec_device *ec_dev;
bce70fef727924 Shawn Nematbakhsh 2017-05-16 341 u8 buf[2];
da1cf5a1cf124f Enrico Granata 2018-10-09 342 int irq, ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 343
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 344 /*
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 345 * The Framework Laptop (and possibly other non-ChromeOS devices)
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 346 * only exposes the eight I/O ports that are required for the Microchip EC.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 347 * Requesting a larger reservation will fail.
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 348 */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 349 if (!devm_request_region(dev, EC_HOST_CMD_REGION0,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 350 EC_HOST_CMD_MEC_REGION_SIZE, dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 351 dev_err(dev, "couldn't reserve MEC region\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 352 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 353 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 354
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 355 /*
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 356 * Read the mapped ID twice, the first one is assuming the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 357 * EC is a Microchip Embedded Controller (MEC) variant, if the
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 358 * protocol fails, fallback to the non MEC variant and try to
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 359 * read again the ID.
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 360 */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 361 cros_ec_lpc_ops.read = cros_ec_lpc_mec_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 362 cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 363 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 364 if (buf[0] != 'E' || buf[1] != 'C') {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 365 if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 366 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 367 dev_err(dev, "couldn't reserve memmap region\n");
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 368 return -EBUSY;
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 369 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 370
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 371 /* Re-assign read/write operations for the non MEC variant */
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 372 cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 373 cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes;
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 374 cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2,
22c040fa21b604 Enric Balletbo i Serra 2019-06-14 375 buf);
bce70fef727924 Shawn Nematbakhsh 2017-05-16 376 if (buf[0] != 'E' || buf[1] != 'C') {
ec2f33ab582bf6 Bill Richardson 2015-02-02 377 dev_err(dev, "EC ID not detected\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 378 return -ENODEV;
ec2f33ab582bf6 Bill Richardson 2015-02-02 379 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 380
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 381 /* Reserve the remaining I/O ports required by the non-MEC protocol. */
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 @382 if (!devm_request_region(dev, EC_HOST_CMD_REGION0 + EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 383 EC_HOST_CMD_REGION_SIZE - EC_HOST_CMD_MEC_REGION_SIZE,
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 384 dev_name(dev))) {
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 385 dev_err(dev, "couldn't reserve remainder of region0\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 386 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 387 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 388 if (!devm_request_region(dev, EC_HOST_CMD_REGION1,
ec2f33ab582bf6 Bill Richardson 2015-02-02 389 EC_HOST_CMD_REGION_SIZE, dev_name(dev))) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 390 dev_err(dev, "couldn't reserve region1\n");
ec2f33ab582bf6 Bill Richardson 2015-02-02 391 return -EBUSY;
ec2f33ab582bf6 Bill Richardson 2015-02-02 392 }
c9bc1a0ef9f613 Dustin L. Howett 2022-02-17 393 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 394
ec2f33ab582bf6 Bill Richardson 2015-02-02 395 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL);
ec2f33ab582bf6 Bill Richardson 2015-02-02 396 if (!ec_dev)
ec2f33ab582bf6 Bill Richardson 2015-02-02 397 return -ENOMEM;
ec2f33ab582bf6 Bill Richardson 2015-02-02 398
ec2f33ab582bf6 Bill Richardson 2015-02-02 399 platform_set_drvdata(pdev, ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 400 ec_dev->dev = dev;
ec2f33ab582bf6 Bill Richardson 2015-02-02 401 ec_dev->phys_name = dev_name(dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 402 ec_dev->cmd_xfer = cros_ec_cmd_xfer_lpc;
d365407079d331 Stephen Barber 2015-06-09 403 ec_dev->pkt_xfer = cros_ec_pkt_xfer_lpc;
ec2f33ab582bf6 Bill Richardson 2015-02-02 404 ec_dev->cmd_readmem = cros_ec_lpc_readmem;
2c7589af3c4dee Stephen Barber 2015-06-09 405 ec_dev->din_size = sizeof(struct ec_host_response) +
2c7589af3c4dee Stephen Barber 2015-06-09 406 sizeof(struct ec_response_get_protocol_info);
2c7589af3c4dee Stephen Barber 2015-06-09 407 ec_dev->dout_size = sizeof(struct ec_host_request);
ec2f33ab582bf6 Bill Richardson 2015-02-02 408
da1cf5a1cf124f Enrico Granata 2018-10-09 409 /*
da1cf5a1cf124f Enrico Granata 2018-10-09 410 * Some boards do not have an IRQ allotted for cros_ec_lpc,
da1cf5a1cf124f Enrico Granata 2018-10-09 411 * which makes ENXIO an expected (and safe) scenario.
da1cf5a1cf124f Enrico Granata 2018-10-09 412 */
a69b4eebe513b8 Enric Balletbo i Serra 2019-11-29 413 irq = platform_get_irq_optional(pdev, 0);
da1cf5a1cf124f Enrico Granata 2018-10-09 414 if (irq > 0)
da1cf5a1cf124f Enrico Granata 2018-10-09 415 ec_dev->irq = irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 416 else if (irq != -ENXIO) {
da1cf5a1cf124f Enrico Granata 2018-10-09 417 dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
da1cf5a1cf124f Enrico Granata 2018-10-09 418 return irq;
da1cf5a1cf124f Enrico Granata 2018-10-09 419 }
da1cf5a1cf124f Enrico Granata 2018-10-09 420
ec2f33ab582bf6 Bill Richardson 2015-02-02 421 ret = cros_ec_register(ec_dev);
ec2f33ab582bf6 Bill Richardson 2015-02-02 422 if (ret) {
ec2f33ab582bf6 Bill Richardson 2015-02-02 423 dev_err(dev, "couldn't register ec_dev (%d)\n", ret);
ec2f33ab582bf6 Bill Richardson 2015-02-02 424 return ret;
ec2f33ab582bf6 Bill Richardson 2015-02-02 425 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 426
a6df7798d03b29 Gwendal Grignou 2017-05-16 427 /*
a6df7798d03b29 Gwendal Grignou 2017-05-16 428 * Connect a notify handler to process MKBP messages if we have a
a6df7798d03b29 Gwendal Grignou 2017-05-16 429 * companion ACPI device.
a6df7798d03b29 Gwendal Grignou 2017-05-16 430 */
a6df7798d03b29 Gwendal Grignou 2017-05-16 431 adev = ACPI_COMPANION(dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 432 if (adev) {
a6df7798d03b29 Gwendal Grignou 2017-05-16 433 status = acpi_install_notify_handler(adev->handle,
a6df7798d03b29 Gwendal Grignou 2017-05-16 434 ACPI_ALL_NOTIFY,
a6df7798d03b29 Gwendal Grignou 2017-05-16 435 cros_ec_lpc_acpi_notify,
a6df7798d03b29 Gwendal Grignou 2017-05-16 436 ec_dev);
a6df7798d03b29 Gwendal Grignou 2017-05-16 437 if (ACPI_FAILURE(status))
a6df7798d03b29 Gwendal Grignou 2017-05-16 438 dev_warn(dev, "Failed to register notifier %08x\n",
a6df7798d03b29 Gwendal Grignou 2017-05-16 439 status);
a6df7798d03b29 Gwendal Grignou 2017-05-16 440 }
a6df7798d03b29 Gwendal Grignou 2017-05-16 441
ec2f33ab582bf6 Bill Richardson 2015-02-02 442 return 0;
ec2f33ab582bf6 Bill Richardson 2015-02-02 443 }
ec2f33ab582bf6 Bill Richardson 2015-02-02 444
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-10 19:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 18:48 drivers/platform/chrome/cros_ec_lpc.c:382 cros_ec_lpc_probe() warn: consider using resource_size() here kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-08-10 19:30 kernel test robot
2022-06-20 12:45 kernel test robot
2022-06-17 9:20 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.