lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 07 Mar 2018 14:49:34 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Harish Jenny K N <harish_kandiga@...tor.com>,
        Avri Altman <Avri.Altman@....com>,
        "ulf.hansson@...aro.org" <ulf.hansson@...aro.org>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
        "shawn.lin@...k-chips.com" <shawn.lin@...k-chips.com>
Cc:     "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Vladimir_Zapolskiy@...tor.com" <Vladimir_Zapolskiy@...tor.com>
Subject: Re: [PATCH v6] mmc: Export host capabilities to debugfs.

On Wed, 2018-03-07 at 12:34 +0530, Harish Jenny K N wrote:

> > > > > > 
> > > +static int mmc_caps_show(struct seq_file *s, void *unused) {
> > > +	struct mmc_host *host = s->private;
> > > +	u32 caps = host->caps;
> > > +
> > > > > > +	seq_puts(s, "\nMMC Host capabilities are:\n");

First of all, avoid leading '\n' in the messages.

> > > > > > +	seq_puts(s,
> > > 
"=============================================\n");
> > > +	seq_printf(s, "Can the host do 4 bit transfers :\t%s\n",
> > > +		   ((caps & MMC_CAP_4_BIT_DATA) ? "Yes" : "No"));
> > 
> > Maybe use a more compact form, and just call a macro with the
> > applicable (stringified) bit?
> 
> Something like this ?
> 
> #define YN(bit) ((caps & bit) ? "Yes" : "No")
> and then call
> seq_printf(s, "Can the host do 4 bit transfers :\t%s\n",
> YN(MMC_CAP_4_BIT_DATA));
> 

I would rather say something like this:

static const char * const mmc_host_capabilities[] = {
 "4-bit transfers allowed",
 "...",
 ...
};

...
  for_each_set_bit(i, caps)
   seq_printf("%s\n", mmc_host_capabilities[i]);
...


-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ