linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: make scsi_devinfo infrastructure optional
Date: Wed, 9 Feb 2011 15:15:15 +0100	[thread overview]
Message-ID: <201102091515.16202.bzolnier@gmail.com> (raw)

Add SCSI_QUIRKS config option (default y and dependent on EMBEDDED
config option) to allow disabling of scsi_devinfo infrastructure.

The output code size savings are ~14k for CONFIG_SCSI_QUIRKS=n
(as measured on x86-32):

CONFIG_SCSI_QUIRKS=y:
   text    data     bss     dec     hex filename
  47342    4368     628   52338    cc72 drivers/scsi/scsi_mod.o
   3897    2776     260    6933    1b15 drivers/scsi/scsi_devinfo.o

CONFIG_SCSI_QUIRKS=n:
   text    data     bss     dec     hex filename
  42968    1592     368   44928    af80 drivers/scsi/scsi_mod.o

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
Using CONFIG_SCSI_QUIRKS=n it was possible to shrink the binary
code size of the minimal SCSI core configuration by 14% (as measured
on x86-32 few kernel versions ago)..

 drivers/scsi/Kconfig     |    9 +++++++++
 drivers/scsi/Makefile    |    3 ++-
 drivers/scsi/scsi_priv.h |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)

Index: b/drivers/scsi/Kconfig
===================================================================
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -47,6 +47,15 @@ config SCSI_TGT
 	  If you want to use SCSI target mode drivers enable this option.
 	  If you choose M, the module will be called scsi_tgt.
 
+config SCSI_QUIRKS
+	bool "SCSI quirks support" if EMBEDDED
+	default y
+	help
+	  This option enables support for devices that require settings
+	  that differ from the default.
+
+	  If unsure say Y.
+
 config SCSI_NETLINK
 	bool
 	default	n
Index: b/drivers/scsi/Makefile
===================================================================
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -160,7 +160,8 @@ obj-$(CONFIG_SCSI_WAIT_SCAN)	+= scsi_wai
 scsi_mod-y			+= scsi.o hosts.o scsi_ioctl.o constants.o \
 				   scsicam.o scsi_error.o scsi_lib.o
 scsi_mod-$(CONFIG_SCSI_DMA)	+= scsi_lib_dma.o
-scsi_mod-y			+= scsi_scan.o scsi_sysfs.o scsi_devinfo.o
+scsi_mod-y			+= scsi_scan.o scsi_sysfs.o
+scsi_mod-$(CONFIG_SCSI_QUIRKS)	+= scsi_devinfo.o
 scsi_mod-$(CONFIG_SCSI_NETLINK)	+= scsi_netlink.o
 scsi_mod-$(CONFIG_SYSCTL)	+= scsi_sysctl.o
 scsi_mod-$(CONFIG_SCSI_PROC_FS)	+= scsi_proc.o
Index: b/drivers/scsi/scsi_priv.h
===================================================================
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -47,6 +47,7 @@ enum {
 	SCSI_DEVINFO_SPI,
 };
 
+#ifdef CONFIG_SCSI_QUIRKS
 extern int scsi_get_device_flags(struct scsi_device *sdev,
 				 const unsigned char *vendor,
 				 const unsigned char *model);
@@ -61,6 +62,38 @@ extern int scsi_dev_info_remove_list(int
 
 extern int __init scsi_init_devinfo(void);
 extern void scsi_exit_devinfo(void);
+#else
+static inline int scsi_get_device_flags(struct scsi_device *sdev,
+					const unsigned char *vendor,
+					const unsigned char *model)
+{
+	return 0;
+}
+static inline int scsi_get_device_flags_keyed(struct scsi_device *sdev,
+					      const unsigned char *vendor,
+					      const unsigned char *model,
+					      int key)
+{
+	return 0;
+}
+static inline int scsi_dev_info_list_add_keyed(int compatible, char *vendor,
+					       char *model, char *strflags,
+					       int flags, int key)
+{
+	return 0;
+}
+static inline int scsi_dev_info_add_list(int key, const char *name)
+{
+	return 0;
+}
+static inline int scsi_dev_info_remove_list(int key)
+{
+	return 0;
+}
+
+static inline int scsi_init_devinfo(void) { return 0; }
+static inline void scsi_exit_devinfo(void) { }
+#endif
 
 /* scsi_error.c */
 extern enum blk_eh_timer_return scsi_times_out(struct request *req);

             reply	other threads:[~2011-02-09 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 14:15 Bartlomiej Zolnierkiewicz [this message]
2011-02-09 18:00 ` [PATCH] scsi: make scsi_devinfo infrastructure optional James Bottomley
2011-02-10  9:18   ` Bartlomiej Zolnierkiewicz
2011-02-10 15:07     ` James Bottomley
2011-02-11  9:52       ` Bartlomiej Zolnierkiewicz
2011-02-11 16:06         ` James Bottomley
2011-02-12 12:16           ` Bartlomiej Zolnierkiewicz
2011-02-12 20:54             ` Marcin Slusarz

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=201102091515.16202.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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).