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

Merge tag 'arm-soc/for-4.18/drivers' of https://github.com/Broadcom/stblinux into next/drivers

This pull request contains Broadcom ARM/ARM64/MIPS SoCs drivers changes
for 4.18, please pull the following:

- Florian removes the synthetic struct device in the DPFE driver which
was used to attach sysfs attributes and uses the platform_device we are
probed from instead.

* tag 'arm-soc/for-4.18/drivers' of https://github.com/Broadcom/stblinux:
memory: brcmstb: dpfe: Remove need for dpfe_dev

Signed-off-by: Olof Johansson <olof@lixom.net>

+12 -34
+12 -34
drivers/memory/brcmstb_dpfe.c
··· 176 176 void __iomem *dmem; 177 177 void __iomem *imem; 178 178 struct device *dev; 179 - unsigned int index; 180 179 struct mutex lock; 181 180 }; 182 181 ··· 673 674 { 674 675 struct device *dev = &pdev->dev; 675 676 struct private_data *priv; 676 - struct device *dpfe_dev; 677 677 struct init_data init; 678 678 struct resource *res; 679 - u32 index; 680 679 int ret; 681 680 682 681 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ··· 683 686 684 687 mutex_init(&priv->lock); 685 688 platform_set_drvdata(pdev, priv); 686 - 687 - /* Cell index is optional; default to 0 if not present. */ 688 - ret = of_property_read_u32(dev->of_node, "cell-index", &index); 689 - if (ret) 690 - index = 0; 691 689 692 690 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu"); 693 691 priv->regs = devm_ioremap_resource(dev, res); ··· 707 715 708 716 ret = brcmstb_dpfe_download_firmware(pdev, &init); 709 717 if (ret) 710 - goto err; 718 + return ret; 711 719 712 - dpfe_dev = devm_kzalloc(dev, sizeof(*dpfe_dev), GFP_KERNEL); 713 - if (!dpfe_dev) { 714 - ret = -ENOMEM; 715 - goto err; 716 - } 717 - 718 - priv->dev = dpfe_dev; 719 - priv->index = index; 720 - 721 - dpfe_dev->parent = dev; 722 - dpfe_dev->groups = dpfe_groups; 723 - dpfe_dev->of_node = dev->of_node; 724 - dev_set_drvdata(dpfe_dev, priv); 725 - dev_set_name(dpfe_dev, "dpfe%u", index); 726 - 727 - ret = device_register(dpfe_dev); 728 - if (ret) 729 - goto err; 730 - 731 - dev_info(dev, "registered.\n"); 732 - 733 - return 0; 734 - 735 - err: 736 - dev_err(dev, "failed to initialize -- error %d\n", ret); 720 + ret = sysfs_create_groups(&pdev->dev.kobj, dpfe_groups); 721 + if (!ret) 722 + dev_info(dev, "registered.\n"); 737 723 738 724 return ret; 725 + } 726 + 727 + static int brcmstb_dpfe_remove(struct platform_device *pdev) 728 + { 729 + sysfs_remove_groups(&pdev->dev.kobj, dpfe_groups); 730 + 731 + return 0; 739 732 } 740 733 741 734 static const struct of_device_id brcmstb_dpfe_of_match[] = { ··· 735 758 .of_match_table = brcmstb_dpfe_of_match, 736 759 }, 737 760 .probe = brcmstb_dpfe_probe, 761 + .remove = brcmstb_dpfe_remove, 738 762 .resume = brcmstb_dpfe_resume, 739 763 }; 740 764