Skip to content

Commit

Permalink
NVMe: Only clear the enable bit when disabling controller
Browse files Browse the repository at this point in the history
Many of the bits in the Controller Configuration register may only be
modified when the Enable bit is clear.  Clearing them at the same time
as the Enable bit might be OK, but let's play it safe and only touch the
Enable bit.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
  • Loading branch information
Matthew Wilcox committed May 8, 2013
1 parent ba47e38 commit 44af146
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/nvme-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,10 @@ static int nvme_wait_ready(struct nvme_dev *dev, u64 cap, bool enabled)
*/
static int nvme_disable_ctrl(struct nvme_dev *dev, u64 cap)
{
writel(0, &dev->bar->cc);
u32 cc = readl(&dev->bar->cc);

if (cc & NVME_CC_ENABLE)
writel(cc & ~NVME_CC_ENABLE, &dev->bar->cc);
return nvme_wait_ready(dev, cap, false);
}

Expand Down

0 comments on commit 44af146

Please sign in to comment.