public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: "Darrick J. Wong" <djwong@us.ibm.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>, Greg KH <greg@kroah.com>,
	linux-next@vger.kernel.org, scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] libsas: Check that the firmware loader is present in sas_request_addr
Date: Thu, 06 Mar 2008 15:17:13 -0600	[thread overview]
Message-ID: <1204838233.3062.53.camel@localhost.localdomain> (raw)
In-Reply-To: <20080306210212.GC7430@tree.beaverton.ibm.com>

On Thu, 2008-03-06 at 13:02 -0800, Darrick J. Wong wrote:
> Return an error code in sas_request_addr if the fw loader isn't
> configured.
> 
> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
> ---
> 
>  drivers/scsi/libsas/sas_scsi_host.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
> index 601ec5b..e44be7a 100644
> --- a/drivers/scsi/libsas/sas_scsi_host.c
> +++ b/drivers/scsi/libsas/sas_scsi_host.c
> @@ -1085,6 +1085,7 @@ static void sas_parse_addr(u8 *sas_addr, const char *p)
>  
>  int sas_request_addr(struct Scsi_Host *shost, u8 *addr)
>  {
> +#ifdef CONFIG_FW_LOADER
>  	int res;
>  	const struct firmware *fw;
>  
> @@ -1102,6 +1103,9 @@ int sas_request_addr(struct Scsi_Host *shost, u8 *addr)
>  out:
>  	release_firmware(fw);
>  	return res;
> +#else
> +	return -ENOENT;
> +#endif
>  }
>  EXPORT_SYMBOL_GPL(sas_request_addr);

We could do it that way ... I suspect what Greg was asking for was more
like this:

James

---

diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 33d8f20..4d10c73 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -10,7 +10,10 @@ struct firmware {
 	size_t size;
 	u8 *data;
 };
+
 struct device;
+
+#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
 int request_firmware(const struct firmware **fw, const char *name,
 		     struct device *device);
 int request_firmware_nowait(
@@ -19,4 +22,24 @@ int request_firmware_nowait(
 	void (*cont)(const struct firmware *fw, void *context));
 
 void release_firmware(const struct firmware *fw);
+#else
+static inline int request_firmware(const struct firmware **fw,
+				   const char *name,
+				   struct device *device)
+{
+	return -EINVAL;
+}
+static inline int request_firmware_nowait(
+	struct module *module, int uevent,
+	const char *name, struct device *device, void *context,
+	void (*cont)(const struct firmware *fw, void *context))
+{
+	return -EINVAL;
+}
+
+static inline void release_firmware(const struct firmware *fw)
+{
+}
+#endif
+
 #endif



  reply	other threads:[~2008-03-06 21:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 17:09 next-2008-0306 scsi/libsas build failure Randy Dunlap
2008-03-06 18:16 ` Greg KH
2008-03-06 18:22   ` Randy Dunlap
2008-03-06 21:01     ` Darrick J. Wong
2008-03-06 21:02     ` [PATCH] libsas: Check that the firmware loader is present in sas_request_addr Darrick J. Wong
2008-03-06 21:17       ` James Bottomley [this message]
2008-03-06 21:20         ` Randy Dunlap
2008-03-06 22:04         ` Randy Dunlap
2008-03-06 22:16           ` James Bottomley
2008-03-07  4:54             ` Greg KH
2008-03-07 14:57               ` [PATCH] firmware: provide stubs for the FW_LOADER=n case James Bottomley
2008-03-07 17:08                 ` patch firmware-provide-stubs-for-the-fw_loader-n-case.patch added to gregkh-2.6 tree gregkh

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=1204838233.3062.53.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=djwong@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    /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