[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210040237.y3pAYlkD-lkp@intel.com>
Date: Tue, 4 Oct 2022 02:16:15 +0800
From: kernel test robot <lkp@...el.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: kbuild-all@...ts.01.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [driver-core:kobject-const 15/18]
arch/parisc/kernel/drivers.c:580:23: warning: passing argument 1 of
'make_modalias' discards 'const' qualifier from pointer target type
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git kobject-const
head: 9f03f357aab62f25e828feb0be7423fff02b2764
commit: 794bcdced821ac77ed4a517b6038baae03d553ea [15/18] driver core: make struct bus_type.uevent() take a const *
config: parisc-allyesconfig
compiler: hppa-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?id=794bcdced821ac77ed4a517b6038baae03d553ea
git remote add driver-core https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
git fetch --no-tags driver-core kobject-const
git checkout 794bcdced821ac77ed4a517b6038baae03d553ea
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash arch/parisc/kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
arch/parisc/kernel/drivers.c:418:31: warning: no previous prototype for 'create_tree_node' [-Wmissing-prototypes]
418 | struct parisc_device * __init create_tree_node(char id, struct device *parent)
| ^~~~~~~~~~~~~~~~
arch/parisc/kernel/drivers.c: In function 'parisc_uevent':
>> arch/parisc/kernel/drivers.c:580:23: warning: passing argument 1 of 'make_modalias' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
580 | make_modalias(dev, modalias);
| ^~~
arch/parisc/kernel/drivers.c:555:45: note: expected 'struct device *' but argument is of type 'const struct device *'
555 | static ssize_t make_modalias(struct device *dev, char *buf)
| ~~~~~~~~~~~~~~~^~~
arch/parisc/kernel/drivers.c: In function 'parse_tree_node':
arch/parisc/kernel/drivers.c:744:30: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
744 | /* nothing */;
| ^
vim +580 arch/parisc/kernel/drivers.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 417
b86db40e1ecc91 Helge Deller 2018-03-04 @418 struct parisc_device * __init create_tree_node(char id, struct device *parent)
^1da177e4c3f41 Linus Torvalds 2005-04-16 419 {
cb6fc18e9ca615 Helge Deller 2006-01-17 420 struct parisc_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 421 if (!dev)
^1da177e4c3f41 Linus Torvalds 2005-04-16 422 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 423
^1da177e4c3f41 Linus Torvalds 2005-04-16 424 dev->hw_path = id;
^1da177e4c3f41 Linus Torvalds 2005-04-16 425 dev->id.hw_type = HPHW_FAULTY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 426
^1da177e4c3f41 Linus Torvalds 2005-04-16 427 dev->dev.parent = parent;
^1da177e4c3f41 Linus Torvalds 2005-04-16 428 setup_bus_id(dev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 429
^1da177e4c3f41 Linus Torvalds 2005-04-16 430 dev->dev.bus = &parisc_bus_type;
^1da177e4c3f41 Linus Torvalds 2005-04-16 431 dev->dma_mask = 0xffffffffUL; /* PARISC devices are 32-bit */
^1da177e4c3f41 Linus Torvalds 2005-04-16 432
^1da177e4c3f41 Linus Torvalds 2005-04-16 433 /* make the generic dma mask a pointer to the parisc one */
^1da177e4c3f41 Linus Torvalds 2005-04-16 434 dev->dev.dma_mask = &dev->dma_mask;
^1da177e4c3f41 Linus Torvalds 2005-04-16 435 dev->dev.coherent_dma_mask = dev->dma_mask;
ba0e427f215b1c Matthew Wilcox 2006-10-04 436 if (device_register(&dev->dev)) {
1070c9655b9001 Matthew Wilcox 2006-10-04 437 kfree(dev);
1070c9655b9001 Matthew Wilcox 2006-10-04 438 return NULL;
1070c9655b9001 Matthew Wilcox 2006-10-04 439 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 440
^1da177e4c3f41 Linus Torvalds 2005-04-16 441 return dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 442 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 443
5658374766d9e0 Matthew Wilcox 2005-10-21 444 struct match_id_data {
5658374766d9e0 Matthew Wilcox 2005-10-21 445 char id;
5658374766d9e0 Matthew Wilcox 2005-10-21 446 struct parisc_device * dev;
5658374766d9e0 Matthew Wilcox 2005-10-21 447 };
5658374766d9e0 Matthew Wilcox 2005-10-21 448
5658374766d9e0 Matthew Wilcox 2005-10-21 449 static int match_by_id(struct device * dev, void * data)
5658374766d9e0 Matthew Wilcox 2005-10-21 450 {
5658374766d9e0 Matthew Wilcox 2005-10-21 451 struct parisc_device * pdev = to_parisc_device(dev);
5658374766d9e0 Matthew Wilcox 2005-10-21 452 struct match_id_data * d = data;
5658374766d9e0 Matthew Wilcox 2005-10-21 453
5658374766d9e0 Matthew Wilcox 2005-10-21 454 if (pdev->hw_path == d->id) {
5658374766d9e0 Matthew Wilcox 2005-10-21 455 d->dev = pdev;
5658374766d9e0 Matthew Wilcox 2005-10-21 456 return 1;
5658374766d9e0 Matthew Wilcox 2005-10-21 457 }
5658374766d9e0 Matthew Wilcox 2005-10-21 458 return 0;
5658374766d9e0 Matthew Wilcox 2005-10-21 459 }
5658374766d9e0 Matthew Wilcox 2005-10-21 460
^1da177e4c3f41 Linus Torvalds 2005-04-16 461 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 462 * alloc_tree_node - returns a device entry in the iotree
^1da177e4c3f41 Linus Torvalds 2005-04-16 463 * @parent: the parent node in the tree
^1da177e4c3f41 Linus Torvalds 2005-04-16 464 * @id: the element of the module path for this entry
^1da177e4c3f41 Linus Torvalds 2005-04-16 465 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 466 * Checks all the children of @parent for a matching @id. If none
^1da177e4c3f41 Linus Torvalds 2005-04-16 467 * found, it allocates a new device and returns it.
^1da177e4c3f41 Linus Torvalds 2005-04-16 468 */
b819439fea305a Helge Deller 2018-04-20 469 static struct parisc_device * __init alloc_tree_node(
b819439fea305a Helge Deller 2018-04-20 470 struct device *parent, char id)
^1da177e4c3f41 Linus Torvalds 2005-04-16 471 {
5658374766d9e0 Matthew Wilcox 2005-10-21 472 struct match_id_data d = {
5658374766d9e0 Matthew Wilcox 2005-10-21 473 .id = id,
5658374766d9e0 Matthew Wilcox 2005-10-21 474 };
5658374766d9e0 Matthew Wilcox 2005-10-21 475 if (device_for_each_child(parent, &d, match_by_id))
5658374766d9e0 Matthew Wilcox 2005-10-21 476 return d.dev;
5658374766d9e0 Matthew Wilcox 2005-10-21 477 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 478 return create_tree_node(id, parent);
^1da177e4c3f41 Linus Torvalds 2005-04-16 479 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 480
^1da177e4c3f41 Linus Torvalds 2005-04-16 481 static struct parisc_device *create_parisc_device(struct hardware_path *modpath)
^1da177e4c3f41 Linus Torvalds 2005-04-16 482 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 483 int i;
^1da177e4c3f41 Linus Torvalds 2005-04-16 484 struct device *parent = &root;
^1da177e4c3f41 Linus Torvalds 2005-04-16 485 for (i = 0; i < 6; i++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 486 if (modpath->bc[i] == -1)
^1da177e4c3f41 Linus Torvalds 2005-04-16 487 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 488 parent = &alloc_tree_node(parent, modpath->bc[i])->dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 489 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 490 return alloc_tree_node(parent, modpath->mod);
^1da177e4c3f41 Linus Torvalds 2005-04-16 491 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 492
b86db40e1ecc91 Helge Deller 2018-03-04 493 struct parisc_device * __init
^1da177e4c3f41 Linus Torvalds 2005-04-16 494 alloc_pa_dev(unsigned long hpa, struct hardware_path *mod_path)
^1da177e4c3f41 Linus Torvalds 2005-04-16 495 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 496 int status;
^1da177e4c3f41 Linus Torvalds 2005-04-16 497 unsigned long bytecnt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 498 u8 iodc_data[32];
^1da177e4c3f41 Linus Torvalds 2005-04-16 499 struct parisc_device *dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 500 const char *name;
^1da177e4c3f41 Linus Torvalds 2005-04-16 501
^1da177e4c3f41 Linus Torvalds 2005-04-16 502 /* Check to make sure this device has not already been added - Ryan */
^1da177e4c3f41 Linus Torvalds 2005-04-16 503 if (find_device_by_addr(hpa) != NULL)
^1da177e4c3f41 Linus Torvalds 2005-04-16 504 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 505
^1da177e4c3f41 Linus Torvalds 2005-04-16 506 status = pdc_iodc_read(&bytecnt, hpa, 0, &iodc_data, 32);
^1da177e4c3f41 Linus Torvalds 2005-04-16 507 if (status != PDC_OK)
^1da177e4c3f41 Linus Torvalds 2005-04-16 508 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 509
^1da177e4c3f41 Linus Torvalds 2005-04-16 510 dev = create_parisc_device(mod_path);
^1da177e4c3f41 Linus Torvalds 2005-04-16 511 if (dev->id.hw_type != HPHW_FAULTY) {
5e791d2e4785f9 Andy Shevchenko 2018-05-29 512 pr_err("Two devices have hardware path [%s]. IODC data for second device: %7phN\n"
4269b0d371c43b Matthew Wilcox 2005-11-17 513 "Rearranging GSC cards sometimes helps\n",
5e791d2e4785f9 Andy Shevchenko 2018-05-29 514 parisc_pathname(dev), iodc_data);
^1da177e4c3f41 Linus Torvalds 2005-04-16 515 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 516 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 517
^1da177e4c3f41 Linus Torvalds 2005-04-16 518 dev->id.hw_type = iodc_data[3] & 0x1f;
^1da177e4c3f41 Linus Torvalds 2005-04-16 519 dev->id.hversion = (iodc_data[0] << 4) | ((iodc_data[1] & 0xf0) >> 4);
^1da177e4c3f41 Linus Torvalds 2005-04-16 520 dev->id.hversion_rev = iodc_data[1] & 0x0f;
^1da177e4c3f41 Linus Torvalds 2005-04-16 521 dev->id.sversion = ((iodc_data[4] & 0x0f) << 16) |
^1da177e4c3f41 Linus Torvalds 2005-04-16 522 (iodc_data[5] << 8) | iodc_data[6];
5658374766d9e0 Matthew Wilcox 2005-10-21 523 dev->hpa.start = hpa;
a01c8cb126cb5f Matthew Wilcox 2006-01-10 524 /* This is awkward. The STI spec says that gfx devices may occupy
a01c8cb126cb5f Matthew Wilcox 2006-01-10 525 * 32MB or 64MB. Unfortunately, we don't know how to tell whether
a01c8cb126cb5f Matthew Wilcox 2006-01-10 526 * it's the former or the latter. Assumptions either way can hurt us.
a01c8cb126cb5f Matthew Wilcox 2006-01-10 527 */
a01c8cb126cb5f Matthew Wilcox 2006-01-10 528 if (hpa == 0xf4000000 || hpa == 0xf8000000) {
a01c8cb126cb5f Matthew Wilcox 2006-01-10 529 dev->hpa.end = hpa + 0x03ffffff;
a01c8cb126cb5f Matthew Wilcox 2006-01-10 530 } else if (hpa == 0xf6000000 || hpa == 0xfa000000) {
5658374766d9e0 Matthew Wilcox 2005-10-21 531 dev->hpa.end = hpa + 0x01ffffff;
5658374766d9e0 Matthew Wilcox 2005-10-21 532 } else {
5658374766d9e0 Matthew Wilcox 2005-10-21 533 dev->hpa.end = hpa + 0xfff;
5658374766d9e0 Matthew Wilcox 2005-10-21 534 }
5658374766d9e0 Matthew Wilcox 2005-10-21 535 dev->hpa.flags = IORESOURCE_MEM;
cab56b51ec0e69 Helge Deller 2022-07-18 536 dev->hpa.name = dev->name;
cab56b51ec0e69 Helge Deller 2022-07-18 537 name = parisc_hardware_description(&dev->id) ? : "unknown";
cab56b51ec0e69 Helge Deller 2022-07-18 538 snprintf(dev->name, sizeof(dev->name), "%s [%s]",
cab56b51ec0e69 Helge Deller 2022-07-18 539 name, parisc_pathname(dev));
^1da177e4c3f41 Linus Torvalds 2005-04-16 540
5658374766d9e0 Matthew Wilcox 2005-10-21 541 /* Silently fail things like mouse ports which are subsumed within
5658374766d9e0 Matthew Wilcox 2005-10-21 542 * the keyboard controller
5658374766d9e0 Matthew Wilcox 2005-10-21 543 */
5658374766d9e0 Matthew Wilcox 2005-10-21 544 if ((hpa & 0xfff) == 0 && insert_resource(&iomem_resource, &dev->hpa))
5e791d2e4785f9 Andy Shevchenko 2018-05-29 545 pr_warn("Unable to claim HPA %lx for device %s\n", hpa, name);
5658374766d9e0 Matthew Wilcox 2005-10-21 546
^1da177e4c3f41 Linus Torvalds 2005-04-16 547 return dev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 548 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 549
^1da177e4c3f41 Linus Torvalds 2005-04-16 550 static int parisc_generic_match(struct device *dev, struct device_driver *drv)
^1da177e4c3f41 Linus Torvalds 2005-04-16 551 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 552 return match_device(to_parisc_driver(drv), to_parisc_device(dev));
^1da177e4c3f41 Linus Torvalds 2005-04-16 553 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 554
7246c31e45021b Helge Deller 2008-12-25 555 static ssize_t make_modalias(struct device *dev, char *buf)
7246c31e45021b Helge Deller 2008-12-25 556 {
7246c31e45021b Helge Deller 2008-12-25 557 const struct parisc_device *padev = to_parisc_device(dev);
7246c31e45021b Helge Deller 2008-12-25 558 const struct parisc_device_id *id = &padev->id;
7246c31e45021b Helge Deller 2008-12-25 559
7246c31e45021b Helge Deller 2008-12-25 560 return sprintf(buf, "parisc:t%02Xhv%04Xrev%02Xsv%08X\n",
7246c31e45021b Helge Deller 2008-12-25 561 (u8)id->hw_type, (u16)id->hversion, (u8)id->hversion_rev,
7246c31e45021b Helge Deller 2008-12-25 562 (u32)id->sversion);
7246c31e45021b Helge Deller 2008-12-25 563 }
7246c31e45021b Helge Deller 2008-12-25 564
794bcdced821ac Greg Kroah-Hartman 2022-09-29 565 static int parisc_uevent(const struct device *dev, struct kobj_uevent_env *env)
7246c31e45021b Helge Deller 2008-12-25 566 {
7246c31e45021b Helge Deller 2008-12-25 567 const struct parisc_device *padev;
7246c31e45021b Helge Deller 2008-12-25 568 char modalias[40];
7246c31e45021b Helge Deller 2008-12-25 569
7246c31e45021b Helge Deller 2008-12-25 570 if (!dev)
7246c31e45021b Helge Deller 2008-12-25 571 return -ENODEV;
7246c31e45021b Helge Deller 2008-12-25 572
7246c31e45021b Helge Deller 2008-12-25 573 padev = to_parisc_device(dev);
7246c31e45021b Helge Deller 2008-12-25 574 if (!padev)
7246c31e45021b Helge Deller 2008-12-25 575 return -ENODEV;
7246c31e45021b Helge Deller 2008-12-25 576
7246c31e45021b Helge Deller 2008-12-25 577 if (add_uevent_var(env, "PARISC_NAME=%s", padev->name))
7246c31e45021b Helge Deller 2008-12-25 578 return -ENOMEM;
7246c31e45021b Helge Deller 2008-12-25 579
7246c31e45021b Helge Deller 2008-12-25 @580 make_modalias(dev, modalias);
7246c31e45021b Helge Deller 2008-12-25 581 if (add_uevent_var(env, "MODALIAS=%s", modalias))
7246c31e45021b Helge Deller 2008-12-25 582 return -ENOMEM;
7246c31e45021b Helge Deller 2008-12-25 583
7246c31e45021b Helge Deller 2008-12-25 584 return 0;
7246c31e45021b Helge Deller 2008-12-25 585 }
7246c31e45021b Helge Deller 2008-12-25 586
:::::: The code at line 580 was first introduced by commit
:::::: 7246c31e45021bc68688c4a8fd2bbb70b485d1ef parisc: add uevent helper for parisc bus
:::::: TO: Helge Deller <deller@....de>
:::::: CC: Kyle McMartin <kyle@...artin.ca>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (312501 bytes)
Powered by blists - more mailing lists