lkml.org 
[lkml]   [2018]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 07/28] fpga: dfl: add chardev support for feature devices
On Thu, Jun 07, 2018 at 01:03:18PM -0500, Alan Tull wrote:
> On Wed, Jun 6, 2018 at 7:24 AM, Wu Hao <hao.wu@intel.com> wrote:
>
> Hi Hao,
>
> One more...
>
> >> > +static dev_t dfl_get_devt(enum dfl_fpga_devt_type type, int id)
> >> > +{
> >> > + WARN_ON(type >= DFL_FPGA_DEVT_MAX);
> >> > +
> >> > + return MKDEV(MAJOR(dfl_chrdevs[type].devt), id);
> >> > +}
> >> > +
> >> > +/**
> >> > + * dfl_fpga_register_dev_ops - register cdev ops for feature dev
> >> > + *
> >> > + * @pdev: feature dev.
> >> > + * @fops: file operations for feature dev's cdev.
> >> > + * @owner: owning module/driver.
> >> > + *
> >> > + * Return: 0 on success, negative error code otherwise.
> >> > + */
> >> > +int dfl_fpga_register_dev_ops(struct platform_device *pdev,
> >> > + const struct file_operations *fops,
> >> > + struct module *owner)
> >> > +{
> >> > + struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
> >> > +
> >> > + cdev_init(&pdata->cdev, fops);
> >> > + pdata->cdev.owner = owner;
> >> > +
> >> > + /*
> >> > + * set parent to the feature device so that its refcount is
> >> > + * decreased after the last refcount of cdev is gone, that
> >> > + * makes sure the feature device is valid during device
> >> > + * file's life-cycle.
> >> > + */
> >> > + pdata->cdev.kobj.parent = &pdev->dev.kobj;
> >> > +
> >> > + return cdev_add(&pdata->cdev, pdev->dev.devt, 1);
> >> > +}
> >> > +EXPORT_SYMBOL_GPL(dfl_fpga_register_dev_ops);
> >> > +
> >> > +/**
> >> > + * dfl_fpga_unregister_dev_ops - unregister cdev ops for feature dev
> >> > + * @pdev: feature dev.
> >> > + */
> >> > +void dfl_fpga_unregister_dev_ops(struct platform_device *pdev)
> >> > +{
> >> > + struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
> >> > +
> >> > + cdev_del(&pdata->cdev);
> >> > +}
> >> > +EXPORT_SYMBOL_GPL(dfl_fpga_unregister_dev_ops);
>
> How about dfl_fpga_dev_ops_register/unregister?

Sure, will fix this in the v6. Thanks.

Hao

>
> Thanks,
> Alan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

\
 
 \ /
  Last update: 2018-06-08 02:22    [W:0.099 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site