From patchwork Tue Nov 24 13:26:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 7690811 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7599C05CA for ; Tue, 24 Nov 2015 13:28:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0099206F6 for ; Tue, 24 Nov 2015 13:28:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 033AB206FA for ; Tue, 24 Nov 2015 13:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbbKXN1M (ORCPT ); Tue, 24 Nov 2015 08:27:12 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:33514 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753778AbbKXN1J (ORCPT ); Tue, 24 Nov 2015 08:27:09 -0500 Received: by wmec201 with SMTP id c201so208829667wme.0 for ; Tue, 24 Nov 2015 05:27:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=A+aSFu5OICaSNLxWZcStMbdBNkKIYAj93f9fPFVSG4w=; b=JHDuqhkBLKPOaH2dSFWcq3+Pr8PZrzY+xhjNBvA1FnPSl5PqBNFAMHLuZuRxW2aV43 MOgswNmCT83B0GoFRwOQl3WdcvfFPtGyrOcVR5Up2R4WWPUckEqYehUjj/rkSUXcHOkK gvin/tZdgI1PyCCGoFh8hYnbTHmamKEf1jq94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=A+aSFu5OICaSNLxWZcStMbdBNkKIYAj93f9fPFVSG4w=; b=igK9QCNzwoqVTksopRvua05thtQ4AlFqBpf1Vg6DxcNhxx5AcOcZmnaba+FVpuPQuT shwszzPTN2LkY3+TuGckm6CsCq0CH/oeVEVKs/HsmcUdl8jozOhEjA+GTSWi9lTM+TEK ZUub3HzhtNLl39p/WmFdbuWUSJ4KopDD4okpjSnC0nI0Jf1xoi9XHb+O+SyBz4bhc08X 6FxolrU2CcaP+J0AqknOrZ6RYMR7WS+AN5mSiytm+6sIzc9sXJC4lrw2xwgzbK7iFjFX ssa/RBCFUnLf848IvAYupKFuREH7ZmThsy8uoyx5XgU9WYAnutmwxkCZN9LSQGYBSvLB YyKw== X-Gm-Message-State: ALoCoQn1SOczPECZ3he/X8oGULljCk9v0rXlHoehL/H/1bcZDpIaxadu06Txmb6ukaIBEINbACEW X-Received: by 10.28.177.11 with SMTP id a11mr24000720wmf.92.1448371628389; Tue, 24 Nov 2015 05:27:08 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id w67sm18215045wmw.17.2015.11.24.05.27.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Nov 2015 05:27:07 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: hch@infradead.org, keith.busch@intel.com, sudipm.mukherjee@gmail.com, ww.tao0320@gmail.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 2/5] lightnvm: Simplify config when disabled Date: Tue, 24 Nov 2015 14:26:45 +0100 Message-Id: <1448371608-18053-3-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448371608-18053-1-git-send-email-m@bjorling.me> References: <1448371608-18053-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Keith Busch We shouldn't compile an object file to get empty implementations; conforms to linux coding style on conditional compilation. Reported-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Matias Bjørling --- drivers/nvme/host/Makefile | 3 ++- drivers/nvme/host/lightnvm.c | 13 ------------- drivers/nvme/host/nvme.h | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/nvme/host/Makefile b/drivers/nvme/host/Makefile index 219dc206..a5fe239 100644 --- a/drivers/nvme/host/Makefile +++ b/drivers/nvme/host/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_BLK_DEV_NVME) += nvme.o -nvme-y += pci.o scsi.o lightnvm.o +lightnvm-$(CONFIG_NVM) := lightnvm.o +nvme-y += pci.o scsi.o $(lightnvm-y) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 0789265..7fd20e5 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -22,8 +22,6 @@ #include "nvme.h" -#ifdef CONFIG_NVM - #include #include #include @@ -588,14 +586,3 @@ int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) return 0; } -#else -int nvme_nvm_register(struct request_queue *q, char *disk_name) -{ - return 0; -} -void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {}; -int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) -{ - return 0; -} -#endif /* CONFIG_NVM */ diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index fdb4e5b..044253d 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -136,8 +136,22 @@ int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr); int nvme_sg_io32(struct nvme_ns *ns, unsigned long arg); int nvme_sg_get_version_num(int __user *ip); +#ifdef CONFIG_NVM int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id); int nvme_nvm_register(struct request_queue *q, char *disk_name); void nvme_nvm_unregister(struct request_queue *q, char *disk_name); +#else +static inline int nvme_nvm_register(struct request_queue *q, char *disk_name) +{ + return 0; +} + +static inline void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {}; + +static inline int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) +{ + return 0; +} +#endif /* CONFIG_NVM */ #endif /* _NVME_H */