Skip to content

Commit

Permalink
fpga: dfl: fme: convert platform_driver to use dev_groups
Browse files Browse the repository at this point in the history
This patch takes advantage of driver core which helps to create
and remove sysfs attribute files, so there is no need to register
sysfs entries manually in dfl-fme platform river code.

Signed-off-by: Wu Hao <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
Signed-off-by: Moritz Fischer <[email protected]>
  • Loading branch information
WuHao270 authored and mfischer committed Sep 4, 2019
1 parent 84b693e commit 084c3ff
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions drivers/fpga/dfl-fme-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,30 +129,6 @@ static struct attribute *fme_hdr_attrs[] = {
};
ATTRIBUTE_GROUPS(fme_hdr);

static int fme_hdr_init(struct platform_device *pdev,
struct dfl_feature *feature)
{
void __iomem *base = feature->ioaddr;
int ret;

dev_dbg(&pdev->dev, "FME HDR Init.\n");
dev_dbg(&pdev->dev, "FME cap %llx.\n",
(unsigned long long)readq(base + FME_HDR_CAP));

ret = device_add_groups(&pdev->dev, fme_hdr_groups);
if (ret)
return ret;

return 0;
}

static void fme_hdr_uinit(struct platform_device *pdev,
struct dfl_feature *feature)
{
dev_dbg(&pdev->dev, "FME HDR UInit.\n");
device_remove_groups(&pdev->dev, fme_hdr_groups);
}

static long fme_hdr_ioctl_release_port(struct dfl_feature_platform_data *pdata,
unsigned long arg)
{
Expand Down Expand Up @@ -199,8 +175,6 @@ static const struct dfl_feature_id fme_hdr_id_table[] = {
};

static const struct dfl_feature_ops fme_hdr_ops = {
.init = fme_hdr_init,
.uinit = fme_hdr_uinit,
.ioctl = fme_hdr_ioctl,
};

Expand Down Expand Up @@ -361,7 +335,8 @@ static int fme_remove(struct platform_device *pdev)

static struct platform_driver fme_driver = {
.driver = {
.name = DFL_FPGA_FEATURE_DEV_FME,
.name = DFL_FPGA_FEATURE_DEV_FME,
.dev_groups = fme_hdr_groups,
},
.probe = fme_probe,
.remove = fme_remove,
Expand Down

0 comments on commit 084c3ff

Please sign in to comment.