public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* puzzling code in nvme_configure_admin_queue()
@ 2013-06-07 11:45 Dan Carpenter
  2013-06-07 13:44 ` Wilcox, Matthew R
  2013-06-07 20:55 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-06-07 11:45 UTC (permalink / raw)
  To: kernel-janitors

Hi Matthew,

The patch b60503ba432b: "NVMe: New driver" from Jan 20, 2011, leads 
to the following warning:
"drivers/block/nvme-core.c:1174 nvme_configure_admin_queue()
	 warn: foo |= 0"

drivers/block/nvme-core.c
  1173          dev->ctrl_config = NVME_CC_ENABLE | NVME_CC_CSS_NVM;
  1174          dev->ctrl_config |= (PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How is this used?  Most of the time PAGE_SHIFT is 12 so this
statement is a no-op.  I searched for NVME_CC_MPS_SHIFT but I didn't
find anything.

  1175          dev->ctrl_config |= NVME_CC_ARB_RR | NVME_CC_SHN_NONE;
  1176          dev->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES;

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: puzzling code in nvme_configure_admin_queue()
  2013-06-07 11:45 puzzling code in nvme_configure_admin_queue() Dan Carpenter
@ 2013-06-07 13:44 ` Wilcox, Matthew R
  2013-06-07 20:55 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Wilcox, Matthew R @ 2013-06-07 13:44 UTC (permalink / raw)
  To: kernel-janitors

Hi Dan,

We have to program the device with the page size so it knows where the page boundaries are.
I could put all this on one logical line like this:

dev->ctrl_config = NVME_CC_ENABLE | NVME_CC_CSS_NVM |
                           ((PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT |
                           NVME_CC_ARB_RR | NVME_CC_SHN_NONE |
                           NVME_CC_IOSQES | NVME_CC_IOCQES;

in order to shut up the warning, but is that really more readable?
________________________________________
From: Dan Carpenter [dan.carpenter@oracle.com]
Sent: June 7, 2013 4:45 AM
To: Wilcox, Matthew R
Cc: kernel-janitors@vger.kernel.org; Busch, Keith; Verma, Vishal L; Dave Jones
Subject: puzzling code in nvme_configure_admin_queue()

Hi Matthew,

The patch b60503ba432b: "NVMe: New driver" from Jan 20, 2011, leads
to the following warning:
"drivers/block/nvme-core.c:1174 nvme_configure_admin_queue()
         warn: foo |= 0"

drivers/block/nvme-core.c
  1173          dev->ctrl_config = NVME_CC_ENABLE | NVME_CC_CSS_NVM;
  1174          dev->ctrl_config |= (PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How is this used?  Most of the time PAGE_SHIFT is 12 so this
statement is a no-op.  I searched for NVME_CC_MPS_SHIFT but I didn't
find anything.

  1175          dev->ctrl_config |= NVME_CC_ARB_RR | NVME_CC_SHN_NONE;
  1176          dev->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES;

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: puzzling code in nvme_configure_admin_queue()
  2013-06-07 11:45 puzzling code in nvme_configure_admin_queue() Dan Carpenter
  2013-06-07 13:44 ` Wilcox, Matthew R
@ 2013-06-07 20:55 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-06-07 20:55 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Jun 07, 2013 at 01:44:24PM +0000, Wilcox, Matthew R wrote:
> Hi Dan,
> 
> We have to program the device with the page size so it knows where the page boundaries are.
> I could put all this on one logical line like this:
> 
> dev->ctrl_config = NVME_CC_ENABLE | NVME_CC_CSS_NVM |
>                            ((PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT |
>                            NVME_CC_ARB_RR | NVME_CC_SHN_NONE |
>                            NVME_CC_IOSQES | NVME_CC_IOCQES;
> 
> in order to shut up the warning, but is that really more readable?

It wouldn't shut up the complaint either...

No worries.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-07 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 11:45 puzzling code in nvme_configure_admin_queue() Dan Carpenter
2013-06-07 13:44 ` Wilcox, Matthew R
2013-06-07 20:55 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox