[PATCH 05/14] staging: most: enable configfs support
kbuild test robot
lkp at intel.com
Sat Mar 23 21:43:48 UTC 2019
Hi Christian,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.1-rc1 next-20190322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Christian-Gromm/staging-most-switch-to-configfs/20190322-075523
config: x86_64-randconfig-i1-03180048 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/staging/most/configfs.o: In function `most_snd_grp_make_item':
>> drivers/staging/most/configfs.c:484: undefined reference to `config_item_init_type_name'
drivers/staging/most/configfs.o: In function `most_common_make_item':
drivers/staging/most/configfs.c:404: undefined reference to `config_item_init_type_name'
drivers/staging/most/configfs.o: In function `most_sound_make_group':
>> drivers/staging/most/configfs.c:576: undefined reference to `config_group_init_type_name'
drivers/staging/most/configfs.o: In function `most_register_configfs_subsys':
>> drivers/staging/most/configfs.c:606: undefined reference to `configfs_register_subsystem'
drivers/staging/most/configfs.c:608: undefined reference to `configfs_register_subsystem'
drivers/staging/most/configfs.c:610: undefined reference to `configfs_register_subsystem'
drivers/staging/most/configfs.c:612: undefined reference to `configfs_register_subsystem'
drivers/staging/most/configfs.o: In function `most_deregister_configfs_subsys':
>> drivers/staging/most/configfs.c:628: undefined reference to `configfs_unregister_subsystem'
drivers/staging/most/configfs.c:630: undefined reference to `configfs_unregister_subsystem'
drivers/staging/most/configfs.c:632: undefined reference to `configfs_unregister_subsystem'
drivers/staging/most/configfs.c:634: undefined reference to `configfs_unregister_subsystem'
drivers/staging/most/configfs.o: In function `configfs_init':
>> drivers/staging/most/configfs.c:640: undefined reference to `config_group_init'
drivers/staging/most/configfs.c:643: undefined reference to `config_group_init'
drivers/staging/most/configfs.c:646: undefined reference to `config_group_init'
drivers/staging/most/configfs.c:649: undefined reference to `config_group_init'
vim +484 drivers/staging/most/configfs.c
590f3182 Christian Gromm 2019-03-21 394
590f3182 Christian Gromm 2019-03-21 395 static struct config_item *most_common_make_item(struct config_group *group,
590f3182 Christian Gromm 2019-03-21 396 const char *name)
590f3182 Christian Gromm 2019-03-21 397 {
590f3182 Christian Gromm 2019-03-21 398 struct mdev_link *mdev_link;
590f3182 Christian Gromm 2019-03-21 399
590f3182 Christian Gromm 2019-03-21 400 mdev_link = kzalloc(sizeof(*mdev_link), GFP_KERNEL);
590f3182 Christian Gromm 2019-03-21 401 if (!mdev_link)
590f3182 Christian Gromm 2019-03-21 402 return ERR_PTR(-ENOMEM);
590f3182 Christian Gromm 2019-03-21 403
590f3182 Christian Gromm 2019-03-21 @404 config_item_init_type_name(&mdev_link->item, name,
590f3182 Christian Gromm 2019-03-21 405 &mdev_link_type);
590f3182 Christian Gromm 2019-03-21 406
590f3182 Christian Gromm 2019-03-21 407 if (!strcmp(group->cg_item.ci_namebuf, "most_cdev"))
590f3182 Christian Gromm 2019-03-21 408 strcpy(mdev_link->comp, "cdev");
590f3182 Christian Gromm 2019-03-21 409 else if (!strcmp(group->cg_item.ci_namebuf, "most_net"))
590f3182 Christian Gromm 2019-03-21 410 strcpy(mdev_link->comp, "net");
590f3182 Christian Gromm 2019-03-21 411 else if (!strcmp(group->cg_item.ci_namebuf, "most_video"))
590f3182 Christian Gromm 2019-03-21 412 strcpy(mdev_link->comp, "video");
590f3182 Christian Gromm 2019-03-21 413 strcpy(mdev_link->name, name);
590f3182 Christian Gromm 2019-03-21 414 return &mdev_link->item;
590f3182 Christian Gromm 2019-03-21 415 }
590f3182 Christian Gromm 2019-03-21 416
590f3182 Christian Gromm 2019-03-21 417 static void most_common_release(struct config_item *item)
590f3182 Christian Gromm 2019-03-21 418 {
590f3182 Christian Gromm 2019-03-21 419 kfree(to_most_common(item));
590f3182 Christian Gromm 2019-03-21 420 }
590f3182 Christian Gromm 2019-03-21 421
590f3182 Christian Gromm 2019-03-21 422 static struct configfs_item_operations most_common_item_ops = {
590f3182 Christian Gromm 2019-03-21 423 .release = most_common_release,
590f3182 Christian Gromm 2019-03-21 424 };
590f3182 Christian Gromm 2019-03-21 425
590f3182 Christian Gromm 2019-03-21 426 static struct configfs_group_operations most_common_group_ops = {
590f3182 Christian Gromm 2019-03-21 427 .make_item = most_common_make_item,
590f3182 Christian Gromm 2019-03-21 428 };
590f3182 Christian Gromm 2019-03-21 429
590f3182 Christian Gromm 2019-03-21 430 static const struct config_item_type most_common_type = {
590f3182 Christian Gromm 2019-03-21 431 .ct_item_ops = &most_common_item_ops,
590f3182 Christian Gromm 2019-03-21 432 .ct_group_ops = &most_common_group_ops,
590f3182 Christian Gromm 2019-03-21 433 .ct_owner = THIS_MODULE,
590f3182 Christian Gromm 2019-03-21 434 };
590f3182 Christian Gromm 2019-03-21 435
590f3182 Christian Gromm 2019-03-21 436 static struct configfs_subsystem most_cdev_subsys = {
590f3182 Christian Gromm 2019-03-21 437 .su_group = {
590f3182 Christian Gromm 2019-03-21 438 .cg_item = {
590f3182 Christian Gromm 2019-03-21 439 .ci_namebuf = "most_cdev",
590f3182 Christian Gromm 2019-03-21 440 .ci_type = &most_common_type,
590f3182 Christian Gromm 2019-03-21 441 },
590f3182 Christian Gromm 2019-03-21 442 },
590f3182 Christian Gromm 2019-03-21 443 };
590f3182 Christian Gromm 2019-03-21 444
590f3182 Christian Gromm 2019-03-21 445 static struct configfs_subsystem most_net_subsys = {
590f3182 Christian Gromm 2019-03-21 446 .su_group = {
590f3182 Christian Gromm 2019-03-21 447 .cg_item = {
590f3182 Christian Gromm 2019-03-21 448 .ci_namebuf = "most_net",
590f3182 Christian Gromm 2019-03-21 449 .ci_type = &most_common_type,
590f3182 Christian Gromm 2019-03-21 450 },
590f3182 Christian Gromm 2019-03-21 451 },
590f3182 Christian Gromm 2019-03-21 452 };
590f3182 Christian Gromm 2019-03-21 453
590f3182 Christian Gromm 2019-03-21 454 static struct configfs_subsystem most_video_subsys = {
590f3182 Christian Gromm 2019-03-21 455 .su_group = {
590f3182 Christian Gromm 2019-03-21 456 .cg_item = {
590f3182 Christian Gromm 2019-03-21 457 .ci_namebuf = "most_video",
590f3182 Christian Gromm 2019-03-21 458 .ci_type = &most_common_type,
590f3182 Christian Gromm 2019-03-21 459 },
590f3182 Christian Gromm 2019-03-21 460 },
590f3182 Christian Gromm 2019-03-21 461 };
590f3182 Christian Gromm 2019-03-21 462
590f3182 Christian Gromm 2019-03-21 463 struct most_snd_grp {
590f3182 Christian Gromm 2019-03-21 464 struct config_group group;
590f3182 Christian Gromm 2019-03-21 465 int create;
590f3182 Christian Gromm 2019-03-21 466 struct list_head list;
590f3182 Christian Gromm 2019-03-21 467 };
590f3182 Christian Gromm 2019-03-21 468
590f3182 Christian Gromm 2019-03-21 469 static inline struct most_snd_grp *to_most_snd_grp(struct config_item *item)
590f3182 Christian Gromm 2019-03-21 470 {
590f3182 Christian Gromm 2019-03-21 471 return item ? container_of(to_config_group(item),
590f3182 Christian Gromm 2019-03-21 472 struct most_snd_grp, group) : NULL;
590f3182 Christian Gromm 2019-03-21 473 }
590f3182 Christian Gromm 2019-03-21 474
590f3182 Christian Gromm 2019-03-21 475 static struct config_item *most_snd_grp_make_item(struct config_group *group,
590f3182 Christian Gromm 2019-03-21 476 const char *name)
590f3182 Christian Gromm 2019-03-21 477 {
590f3182 Christian Gromm 2019-03-21 478 struct mdev_link *mdev_link;
590f3182 Christian Gromm 2019-03-21 479
590f3182 Christian Gromm 2019-03-21 480 mdev_link = kzalloc(sizeof(*mdev_link), GFP_KERNEL);
590f3182 Christian Gromm 2019-03-21 481 if (!mdev_link)
590f3182 Christian Gromm 2019-03-21 482 return ERR_PTR(-ENOMEM);
590f3182 Christian Gromm 2019-03-21 483
590f3182 Christian Gromm 2019-03-21 @484 config_item_init_type_name(&mdev_link->item, name, &mdev_link_type);
590f3182 Christian Gromm 2019-03-21 485 mdev_link->create = 0;
590f3182 Christian Gromm 2019-03-21 486 strcpy(mdev_link->name, name);
590f3182 Christian Gromm 2019-03-21 487 strcpy(mdev_link->comp, "sound");
590f3182 Christian Gromm 2019-03-21 488 return &mdev_link->item;
590f3182 Christian Gromm 2019-03-21 489 }
590f3182 Christian Gromm 2019-03-21 490
590f3182 Christian Gromm 2019-03-21 491 static ssize_t most_snd_grp_create_show(struct config_item *item, char *page)
590f3182 Christian Gromm 2019-03-21 492 {
590f3182 Christian Gromm 2019-03-21 493 return sprintf(page, "%d\n", to_most_snd_grp(item)->create);
590f3182 Christian Gromm 2019-03-21 494 }
590f3182 Christian Gromm 2019-03-21 495
590f3182 Christian Gromm 2019-03-21 496 static ssize_t most_snd_grp_create_store(struct config_item *item,
590f3182 Christian Gromm 2019-03-21 497 const char *page, size_t count)
590f3182 Christian Gromm 2019-03-21 498 {
590f3182 Christian Gromm 2019-03-21 499 struct most_snd_grp *snd_grp = to_most_snd_grp(item);
590f3182 Christian Gromm 2019-03-21 500 int ret = 0;
590f3182 Christian Gromm 2019-03-21 501 u16 tmp;
590f3182 Christian Gromm 2019-03-21 502 char *p = (char *)page;
590f3182 Christian Gromm 2019-03-21 503
590f3182 Christian Gromm 2019-03-21 504 ret = kstrtou16(p, 0, &tmp);
590f3182 Christian Gromm 2019-03-21 505 if (ret)
590f3182 Christian Gromm 2019-03-21 506 return ret;
590f3182 Christian Gromm 2019-03-21 507 if (tmp > 1)
590f3182 Christian Gromm 2019-03-21 508 return -ERANGE;
590f3182 Christian Gromm 2019-03-21 509 if (tmp) {
590f3182 Christian Gromm 2019-03-21 510 ret = most_cfg_complete("sound");
590f3182 Christian Gromm 2019-03-21 511 if (ret)
590f3182 Christian Gromm 2019-03-21 512 return ret;
590f3182 Christian Gromm 2019-03-21 513 }
590f3182 Christian Gromm 2019-03-21 514 snd_grp->create = tmp;
590f3182 Christian Gromm 2019-03-21 515 return count;
590f3182 Christian Gromm 2019-03-21 516 }
590f3182 Christian Gromm 2019-03-21 517
590f3182 Christian Gromm 2019-03-21 518 CONFIGFS_ATTR(most_snd_grp_, create);
590f3182 Christian Gromm 2019-03-21 519
590f3182 Christian Gromm 2019-03-21 520 static struct configfs_attribute *most_snd_grp_attrs[] = {
590f3182 Christian Gromm 2019-03-21 521 &most_snd_grp_attr_create,
590f3182 Christian Gromm 2019-03-21 522 NULL,
590f3182 Christian Gromm 2019-03-21 523 };
590f3182 Christian Gromm 2019-03-21 524
590f3182 Christian Gromm 2019-03-21 525 static void most_snd_grp_release(struct config_item *item)
590f3182 Christian Gromm 2019-03-21 526 {
590f3182 Christian Gromm 2019-03-21 527 struct most_snd_grp *group = to_most_snd_grp(item);
590f3182 Christian Gromm 2019-03-21 528
590f3182 Christian Gromm 2019-03-21 529 list_del(&group->list);
590f3182 Christian Gromm 2019-03-21 530 kfree(group);
590f3182 Christian Gromm 2019-03-21 531 }
590f3182 Christian Gromm 2019-03-21 532
590f3182 Christian Gromm 2019-03-21 533 static struct configfs_item_operations most_snd_grp_item_ops = {
590f3182 Christian Gromm 2019-03-21 534 .release = most_snd_grp_release,
590f3182 Christian Gromm 2019-03-21 535 };
590f3182 Christian Gromm 2019-03-21 536
590f3182 Christian Gromm 2019-03-21 537 static struct configfs_group_operations most_snd_grp_group_ops = {
590f3182 Christian Gromm 2019-03-21 538 .make_item = most_snd_grp_make_item,
590f3182 Christian Gromm 2019-03-21 539 };
590f3182 Christian Gromm 2019-03-21 540
590f3182 Christian Gromm 2019-03-21 541 static const struct config_item_type most_snd_grp_type = {
590f3182 Christian Gromm 2019-03-21 542 .ct_item_ops = &most_snd_grp_item_ops,
590f3182 Christian Gromm 2019-03-21 543 .ct_group_ops = &most_snd_grp_group_ops,
590f3182 Christian Gromm 2019-03-21 544 .ct_attrs = most_snd_grp_attrs,
590f3182 Christian Gromm 2019-03-21 545 .ct_owner = THIS_MODULE,
590f3182 Christian Gromm 2019-03-21 546 };
590f3182 Christian Gromm 2019-03-21 547
590f3182 Christian Gromm 2019-03-21 548 struct most_sound {
590f3182 Christian Gromm 2019-03-21 549 struct configfs_subsystem subsys;
590f3182 Christian Gromm 2019-03-21 550 struct list_head soundcard_list;
590f3182 Christian Gromm 2019-03-21 551 };
590f3182 Christian Gromm 2019-03-21 552
590f3182 Christian Gromm 2019-03-21 553 static inline struct most_sound *to_most_sound(struct config_item *item)
590f3182 Christian Gromm 2019-03-21 554 {
590f3182 Christian Gromm 2019-03-21 555 return item ? container_of(to_configfs_subsystem(to_config_group(item)),
590f3182 Christian Gromm 2019-03-21 556 struct most_sound, subsys) : NULL;
590f3182 Christian Gromm 2019-03-21 557 }
590f3182 Christian Gromm 2019-03-21 558
590f3182 Christian Gromm 2019-03-21 559 static struct config_group *most_sound_make_group(struct config_group *group,
590f3182 Christian Gromm 2019-03-21 560 const char *name)
590f3182 Christian Gromm 2019-03-21 561 {
590f3182 Christian Gromm 2019-03-21 562 struct most_snd_grp *most;
590f3182 Christian Gromm 2019-03-21 563 struct most_sound *ms = container_of(to_configfs_subsystem(group),
590f3182 Christian Gromm 2019-03-21 564 struct most_sound, subsys);
590f3182 Christian Gromm 2019-03-21 565
590f3182 Christian Gromm 2019-03-21 566 list_for_each_entry(most, &ms->soundcard_list, list) {
590f3182 Christian Gromm 2019-03-21 567 if (!most->create) {
590f3182 Christian Gromm 2019-03-21 568 pr_info("adapter configuration still in progress.\n");
590f3182 Christian Gromm 2019-03-21 569 return ERR_PTR(-EPROTO);
590f3182 Christian Gromm 2019-03-21 570 }
590f3182 Christian Gromm 2019-03-21 571 }
590f3182 Christian Gromm 2019-03-21 572 most = kzalloc(sizeof(*most), GFP_KERNEL);
590f3182 Christian Gromm 2019-03-21 573 if (!most)
590f3182 Christian Gromm 2019-03-21 574 return ERR_PTR(-ENOMEM);
590f3182 Christian Gromm 2019-03-21 575
590f3182 Christian Gromm 2019-03-21 @576 config_group_init_type_name(&most->group, name, &most_snd_grp_type);
590f3182 Christian Gromm 2019-03-21 577 list_add_tail(&most->list, &ms->soundcard_list);
590f3182 Christian Gromm 2019-03-21 578 return &most->group;
590f3182 Christian Gromm 2019-03-21 579 }
590f3182 Christian Gromm 2019-03-21 580
590f3182 Christian Gromm 2019-03-21 581 static struct configfs_group_operations most_sound_group_ops = {
590f3182 Christian Gromm 2019-03-21 582 .make_group = most_sound_make_group,
590f3182 Christian Gromm 2019-03-21 583 };
590f3182 Christian Gromm 2019-03-21 584
590f3182 Christian Gromm 2019-03-21 585 static const struct config_item_type most_sound_type = {
590f3182 Christian Gromm 2019-03-21 586 .ct_group_ops = &most_sound_group_ops,
590f3182 Christian Gromm 2019-03-21 587 .ct_owner = THIS_MODULE,
590f3182 Christian Gromm 2019-03-21 588 };
590f3182 Christian Gromm 2019-03-21 589
590f3182 Christian Gromm 2019-03-21 590 static struct most_sound most_sound_subsys = {
590f3182 Christian Gromm 2019-03-21 591 .subsys = {
590f3182 Christian Gromm 2019-03-21 592 .su_group = {
590f3182 Christian Gromm 2019-03-21 593 .cg_item = {
590f3182 Christian Gromm 2019-03-21 594 .ci_namebuf = "most_sound",
590f3182 Christian Gromm 2019-03-21 595 .ci_type = &most_sound_type,
590f3182 Christian Gromm 2019-03-21 596 },
590f3182 Christian Gromm 2019-03-21 597 },
590f3182 Christian Gromm 2019-03-21 598 },
590f3182 Christian Gromm 2019-03-21 599 };
590f3182 Christian Gromm 2019-03-21 600
590f3182 Christian Gromm 2019-03-21 601 int most_register_configfs_subsys(struct core_component *c)
590f3182 Christian Gromm 2019-03-21 602 {
590f3182 Christian Gromm 2019-03-21 603 int ret;
590f3182 Christian Gromm 2019-03-21 604
590f3182 Christian Gromm 2019-03-21 605 if (!strcmp(c->name, "cdev"))
590f3182 Christian Gromm 2019-03-21 @606 ret = configfs_register_subsystem(&most_cdev_subsys);
590f3182 Christian Gromm 2019-03-21 607 else if (!strcmp(c->name, "net"))
590f3182 Christian Gromm 2019-03-21 @608 ret = configfs_register_subsystem(&most_net_subsys);
590f3182 Christian Gromm 2019-03-21 609 else if (!strcmp(c->name, "video"))
590f3182 Christian Gromm 2019-03-21 610 ret = configfs_register_subsystem(&most_video_subsys);
590f3182 Christian Gromm 2019-03-21 611 else if (!strcmp(c->name, "sound"))
590f3182 Christian Gromm 2019-03-21 612 ret = configfs_register_subsystem(&most_sound_subsys.subsys);
590f3182 Christian Gromm 2019-03-21 613 else
590f3182 Christian Gromm 2019-03-21 614 return -ENODEV;
590f3182 Christian Gromm 2019-03-21 615
590f3182 Christian Gromm 2019-03-21 616 if (ret) {
590f3182 Christian Gromm 2019-03-21 617 pr_err("Error %d while registering subsystem %s\n",
590f3182 Christian Gromm 2019-03-21 618 ret,
590f3182 Christian Gromm 2019-03-21 619 most_sound_subsys.subsys.su_group.cg_item.ci_namebuf);
590f3182 Christian Gromm 2019-03-21 620 }
590f3182 Christian Gromm 2019-03-21 621 return ret;
590f3182 Christian Gromm 2019-03-21 622 }
590f3182 Christian Gromm 2019-03-21 623 EXPORT_SYMBOL_GPL(most_register_configfs_subsys);
590f3182 Christian Gromm 2019-03-21 624
590f3182 Christian Gromm 2019-03-21 625 void most_deregister_configfs_subsys(struct core_component *c)
590f3182 Christian Gromm 2019-03-21 626 {
590f3182 Christian Gromm 2019-03-21 627 if (!strcmp(c->name, "cdev"))
590f3182 Christian Gromm 2019-03-21 @628 configfs_unregister_subsystem(&most_cdev_subsys);
590f3182 Christian Gromm 2019-03-21 629 else if (!strcmp(c->name, "net"))
590f3182 Christian Gromm 2019-03-21 630 configfs_unregister_subsystem(&most_net_subsys);
590f3182 Christian Gromm 2019-03-21 631 else if (!strcmp(c->name, "video"))
590f3182 Christian Gromm 2019-03-21 632 configfs_unregister_subsystem(&most_video_subsys);
590f3182 Christian Gromm 2019-03-21 633 else if (!strcmp(c->name, "sound"))
590f3182 Christian Gromm 2019-03-21 634 configfs_unregister_subsystem(&most_sound_subsys.subsys);
590f3182 Christian Gromm 2019-03-21 635 }
590f3182 Christian Gromm 2019-03-21 636 EXPORT_SYMBOL_GPL(most_deregister_configfs_subsys);
590f3182 Christian Gromm 2019-03-21 637
590f3182 Christian Gromm 2019-03-21 638 int __init configfs_init(void)
590f3182 Christian Gromm 2019-03-21 639 {
590f3182 Christian Gromm 2019-03-21 @640 config_group_init(&most_cdev_subsys.su_group);
590f3182 Christian Gromm 2019-03-21 641 mutex_init(&most_cdev_subsys.su_mutex);
590f3182 Christian Gromm 2019-03-21 642
590f3182 Christian Gromm 2019-03-21 643 config_group_init(&most_net_subsys.su_group);
590f3182 Christian Gromm 2019-03-21 644 mutex_init(&most_net_subsys.su_mutex);
590f3182 Christian Gromm 2019-03-21 645
590f3182 Christian Gromm 2019-03-21 646 config_group_init(&most_video_subsys.su_group);
590f3182 Christian Gromm 2019-03-21 647 mutex_init(&most_video_subsys.su_mutex);
590f3182 Christian Gromm 2019-03-21 648
590f3182 Christian Gromm 2019-03-21 649 config_group_init(&most_sound_subsys.subsys.su_group);
590f3182 Christian Gromm 2019-03-21 650 mutex_init(&most_sound_subsys.subsys.su_mutex);
590f3182 Christian Gromm 2019-03-21 651
590f3182 Christian Gromm 2019-03-21 652 INIT_LIST_HEAD(&most_sound_subsys.soundcard_list);
590f3182 Christian Gromm 2019-03-21 653
590f3182 Christian Gromm 2019-03-21 654 return 0;
590f3182 Christian Gromm 2019-03-21 655 }
590f3182 Christian Gromm 2019-03-21 656
:::::: The code at line 484 was first introduced by commit
:::::: 590f31828d2a264c02bc4eeebb6722c906aa0444 staging: most: add new file configfs.c
:::::: TO: Christian Gromm <christian.gromm at microchip.com>
:::::: CC: 0day robot <lkp at intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 23929 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20190324/fddb598a/attachment-0001.bin>
More information about the devel
mailing list