From: Ajay Singh <ajay.kathat@microchip.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <devel@driverdev.osuosl.org>, <venkateswara.kaja@microchip.com>,
<linux-wireless@vger.kernel.org>, <ganesh.krishna@microchip.com>,
<adham.abozaeid@microchip.com>, <aditya.shankar@microchip.com>
Subject: Re: [PATCH 1/5] staging: wilc1000: avoid arrray of 'wilc_debugfs_info_t' type
Date: Mon, 13 Aug 2018 10:06:35 +0530 [thread overview]
Message-ID: <20180813100635.356583ae@ajaysk-VirtualBox> (raw)
In-Reply-To: <20180812152421.GB30273@kroah.com>
Hi Greg,
On Sun, 12 Aug 2018 17:24:21 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:
> On Sun, Aug 12, 2018 at 05:18:29PM +0530, Ajay Singh wrote:
> > Hi Greg,
> >
> > On Sun, 12 Aug 2018 13:29:30 +0200
> > Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > > On Sun, Aug 12, 2018 at 10:17:41AM +0530, Ajay Singh wrote:
> > > > Refactor code by removing array of 'wilc_debugfs_info_t' type
> > > > and use single variable to store 'wilc_debugfs_info_t' struct
> > > > value.
> > > >
> > > > Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > > > ---
> > > > drivers/staging/wilc1000/wilc_debugfs.c | 26
> > > > +++++++++----------------- 1 file changed, 9 insertions(+), 17
> > > > deletions(-)
> > > >
> > > > diff --git a/drivers/staging/wilc1000/wilc_debugfs.c
> > > > b/drivers/staging/wilc1000/wilc_debugfs.c index edc7287..c5f67c9
> > > > 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c
> > > > +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> > > > @@ -78,29 +78,21 @@ struct wilc_debugfs_info_t {
> > > > const struct file_operations fops;
> > > > };
> > > >
> > > > -static struct wilc_debugfs_info_t debugfs_info[] = {
> > > > - {
> > > > - "wilc_debug_level",
> > > > - 0666,
> > > > - (DEBUG | ERR),
> > > > - FOPS(NULL, wilc_debug_level_read,
> > > > wilc_debug_level_write, NULL),
> > > > - },
> > > > +static struct wilc_debugfs_info_t debugfs_info = {
> > > > + "wilc_debug_level",
> > > > + 0666,
> > > > + (DEBUG | ERR),
> > > > + FOPS(NULL, wilc_debug_level_read,
> > > > wilc_debug_level_write, NULL), };
> > > >
> > > > int wilc_debugfs_init(void)
> > > > {
> > > > - int i;
> > > > - struct wilc_debugfs_info_t *info;
> > > > + struct wilc_debugfs_info_t *info = &debugfs_info;
> > > >
> > > > wilc_dir = debugfs_create_dir("wilc_wifi", NULL);
> > > > - for (i = 0; i < ARRAY_SIZE(debugfs_info); i++) {
> > > > - info = &debugfs_info[i];
> > > > - debugfs_create_file(info->name,
> > > > - info->perm,
> > > > - wilc_dir,
> > > > - &info->data,
> > > > - &info->fops);
> > > > - }
> > > > + debugfs_create_file(info->name, info->perm, wilc_dir,
> > > > &info->data,
> > > > + &info->fops);
> > > > +
> > >
> > > Why go through the extra step here in changing this variable from
> > > an array to a single value and not just make the call to
> > > debugfs_create_file() directly with the individual values like
> > > you do in patch 3? It feels like this step isn't needed at all
> > > here, right?
> > >
> > > What am I missing?
> >
> > Actually, while calling debugfs_create_file() it also passed the
> > "info->data", "info->perm" which was maintained in a static
> > variable. So to have the changes in multiple patches, I first tried
> > by removing the dependency of array and later changed the
> > individual parameters for this debugfs_create_file().
>
> But you don't need/want that here anyway, it would have been simpler
> to just do it correct in one patch. That would have also been easier
> to review :)
>
> But for now, just delete this file as it is not used at all. Want me
> to do it for you?
>
Thanks for giving your time and support.
I will make the changes and submit the patch to delete wilc_debugfs.c
file.
Regards,
Ajay
next prev parent reply other threads:[~2018-08-13 7:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-12 4:47 [PATCH 0/5] staging: wilc1000: compilation error fixes & cleanup changes Ajay Singh
2018-08-12 4:47 ` [PATCH 1/5] staging: wilc1000: avoid arrray of 'wilc_debugfs_info_t' type Ajay Singh
2018-08-12 11:29 ` Greg KH
2018-08-12 11:48 ` Ajay Singh
2018-08-12 15:24 ` Greg KH
2018-08-13 4:36 ` Ajay Singh [this message]
2018-08-12 4:47 ` [PATCH 2/5] staging: wilc1000: fixes for undefined reference to `__this_module' error Ajay Singh
2018-08-12 6:42 ` Greg KH
2018-08-12 11:22 ` Ajay Singh
2018-08-12 11:27 ` Greg KH
2018-08-12 11:35 ` Greg KH
2018-08-12 12:18 ` Ajay Singh
2018-08-12 15:23 ` Greg KH
2018-08-14 10:56 ` Dan Carpenter
2018-08-14 11:10 ` Arend van Spriel
2018-08-14 11:10 ` Ajay Singh
2018-08-12 4:47 ` [PATCH 3/5] staging: wilc1000: remove the use of 'wilc_debugfs_info_t' struct Ajay Singh
2018-08-12 4:47 ` [PATCH 4/5] staging: wilc1000: change permission to 0600 in debugfs_create_file() call Ajay Singh
2018-08-12 11:36 ` Greg KH
2018-08-12 4:47 ` [PATCH 5/5] staging: wilc1000: use void return for wilc_debugfs_init() Ajay Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180813100635.356583ae@ajaysk-VirtualBox \
--to=ajay.kathat@microchip.com \
--cc=adham.abozaeid@microchip.com \
--cc=aditya.shankar@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=ganesh.krishna@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-wireless@vger.kernel.org \
--cc=venkateswara.kaja@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).