[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJ1ep2RyCT8hcxGd@kroah.com>
Date: Thu, 13 May 2021 19:15:19 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Maciej Kwapulinski <maciej.kwapulinski@...ux.intel.com>
Cc: Arnd Bergmann <arnd@...db.de>, Jonathan Corbet <corbet@....net>,
Derek Kiernan <derek.kiernan@...inx.com>,
Dragan Cvetic <dragan.cvetic@...inx.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
Savo Novakovic <savox.novakovic@...el.com>
Subject: Re: [PATCH v3 12/14] intel_gna: add a 'misc' device
On Thu, May 13, 2021 at 07:06:18PM +0200, Maciej Kwapulinski wrote:
>
> Greg Kroah-Hartman <gregkh@...uxfoundation.org> writes:
>
> > On Thu, May 13, 2021 at 01:00:38PM +0200, Maciej Kwapulinski wrote:
> >> The new 'misc' device is the node for applications in user space to
> >> interact with the driver.
> >>
> >> Signed-off-by: Maciej Kwapulinski <maciej.kwapulinski@...ux.intel.com>
> >> Tested-by: Savo Novakovic <savox.novakovic@...el.com>
> >> ---
> >> drivers/misc/intel/gna/device.c | 52 +++++++++++++++++++++++++++++++--
> >> drivers/misc/intel/gna/device.h | 11 +++----
> >> 2 files changed, 55 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/misc/intel/gna/device.c b/drivers/misc/intel/gna/device.c
> >> index 0e31b8c6bb70..1e6345a8325b 100644
> >> --- a/drivers/misc/intel/gna/device.c
> >> +++ b/drivers/misc/intel/gna/device.c
> >> @@ -20,6 +20,18 @@ module_param(recovery_timeout, int, 0644);
> >> MODULE_PARM_DESC(recovery_timeout, "Recovery timeout in seconds");
> >> #endif
> >>
> >> +struct file;
> >> +
> >> +static int gna_open(struct inode *inode, struct file *f)
> >> +{
> >> + return -EPERM;
> >> +}
> >
> > That sucks, why have an open that does nothing but fail?
>
> next patch provides complete implementation of gna_open(), here it's
> just a protection if someone would incidentally run gna in the middle of patch series
Then don't provide an open at all, and it will be fine :)
>
> >
> >> +
> >> +static const struct file_operations gna_file_ops = {
> >> + .owner = THIS_MODULE,
> >> + .open = gna_open,
> >> +};
> >> +
> >> static void gna_devm_idr_destroy(void *data)
> >> {
> >> struct idr *idr = data;
> >> @@ -27,6 +39,36 @@ static void gna_devm_idr_destroy(void *data)
> >> idr_destroy(idr);
> >> }
> >>
> >> +static void gna_devm_deregister_misc_dev(void *data)
> >
> > Why is this a void *?
>
> it goes to devm_add_action() api.
Ah. That's not obvious :(
Powered by blists - more mailing lists