[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANk1AXTmpa1P55qCwZhyn=CGoa3v_hJ-KFCQsy7kMTBpULc6hQ@mail.gmail.com>
Date: Thu, 7 Jun 2018 13:03:18 -0500
From: Alan Tull <atull@...nel.org>
To: Wu Hao <hao.wu@...el.com>
Cc: Moritz Fischer <mdf@...nel.org>, linux-fpga@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-api@...r.kernel.org, "Kang, Luwei" <luwei.kang@...el.com>,
"Zhang, Yi Z" <yi.z.zhang@...el.com>,
Tim Whisonant <tim.whisonant@...el.com>,
Enno Luebbers <enno.luebbers@...el.com>,
Shiva Rao <shiva.rao@...el.com>,
Christopher Rauer <christopher.rauer@...el.com>,
Xiao Guangrong <guangrong.xiao@...ux.intel.com>
Subject: Re: [PATCH v5 07/28] fpga: dfl: add chardev support for feature devices
On Wed, Jun 6, 2018 at 7:24 AM, Wu Hao <hao.wu@...el.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?
Thanks,
Alan
Powered by blists - more mailing lists