diff mbox

[1/2] ses: use scsi_is_sas_rphy instead of is_sas_attached

Message ID 1471271153.2428.5.camel@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

James Bottomley Aug. 15, 2016, 2:25 p.m. UTC
On Mon, 2016-08-15 at 22:11 +0800, kbuild test robot wrote:
> Hi Johannes,
> 
> [auto build test ERROR on scsi/for-next]
> [also build test ERROR on v4.8-rc2 next-20160815]
> [if your patch is applied to the wrong git tree, please drop us a 
> note to help improve the system]

This is happening because scsi_is_sas_rphy wasn't designed to be used
outside the SAS transport class, so it's failing when the ATTRs aren't
defined.

This is the way you fix it (needs to be a precursor patch to 1/2):

James

---


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Johannes Thumshirn Aug. 15, 2016, 2:40 p.m. UTC | #1
On Mon, Aug 15, 2016 at 07:25:53AM -0700, James Bottomley wrote:
> On Mon, 2016-08-15 at 22:11 +0800, kbuild test robot wrote:
> > Hi Johannes,
> > 
> > [auto build test ERROR on scsi/for-next]
> > [also build test ERROR on v4.8-rc2 next-20160815]
> > [if your patch is applied to the wrong git tree, please drop us a 
> > note to help improve the system]
> 
> This is happening because scsi_is_sas_rphy wasn't designed to be used
> outside the SAS transport class, so it's failing when the ATTRs aren't
> defined.
> 
> This is the way you fix it (needs to be a precursor patch to 1/2):
> 
> James

Thanks, but I'm wondering about the call to sas_get_address(). It was
there before the patch as well and now it's an undefined reference. Am
I missing something here? Sure it can be guarded in the #if block.

> 
> ---
> 
> diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
> index 13c0b2b..0e1c50e 100644
> --- a/include/scsi/scsi_transport_sas.h
> +++ b/include/scsi/scsi_transport_sas.h
> @@ -15,8 +15,13 @@ static inline int is_sas_attached(struct scsi_device *sdev)
>  {
>  	return 0;
>  }
> +static inline int scsi_is_sas_rphy(const struct device *)
> +{
> +	return 0;
> +}
>  #else
>  extern int is_sas_attached(struct scsi_device *sdev);
> +extern int scsi_is_sas_rphy(const struct device *);
>  #endif
>  
>  static inline int sas_protocol_ata(enum sas_protocol proto)
> @@ -202,7 +207,6 @@ extern int sas_rphy_add(struct sas_rphy *);
>  extern void sas_rphy_remove(struct sas_rphy *);
>  extern void sas_rphy_delete(struct sas_rphy *);
>  extern void sas_rphy_unlink(struct sas_rphy *);
> -extern int scsi_is_sas_rphy(const struct device *);
>  
>  struct sas_port *sas_port_alloc(struct device *, int);
>  struct sas_port *sas_port_alloc_num(struct device *);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
James Bottomley Aug. 15, 2016, 2:59 p.m. UTC | #2
On Mon, 2016-08-15 at 16:40 +0200, Johannes Thumshirn wrote:
> On Mon, Aug 15, 2016 at 07:25:53AM -0700, James Bottomley wrote:
> > On Mon, 2016-08-15 at 22:11 +0800, kbuild test robot wrote:
> > > Hi Johannes,
> > > 
> > > [auto build test ERROR on scsi/for-next]
> > > [also build test ERROR on v4.8-rc2 next-20160815]
> > > [if your patch is applied to the wrong git tree, please drop us a
> > > note to help improve the system]
> > 
> > This is happening because scsi_is_sas_rphy wasn't designed to be 
> > used outside the SAS transport class, so it's failing when the 
> > ATTRs aren't defined.
> > 
> > This is the way you fix it (needs to be a precursor patch to 1/2):
> > 
> > James
> 
> Thanks, but I'm wondering about the call to sas_get_address(). It was
> there before the patch as well and now it's an undefined reference. 
> Am I missing something here? Sure it can be guarded in the #if block.

Yes: gcc is kind enough to elide any code that looks like

if (0) {
	refer to something
}

So the static inline ensures anything within the brace isn't used as a
linkable reference.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Thumshirn Aug. 15, 2016, 3:04 p.m. UTC | #3
On Mon, Aug 15, 2016 at 07:59:25AM -0700, James Bottomley wrote:
> On Mon, 2016-08-15 at 16:40 +0200, Johannes Thumshirn wrote:
> > On Mon, Aug 15, 2016 at 07:25:53AM -0700, James Bottomley wrote:
> > > On Mon, 2016-08-15 at 22:11 +0800, kbuild test robot wrote:
> > > > Hi Johannes,
> > > > 
> > > > [auto build test ERROR on scsi/for-next]
> > > > [also build test ERROR on v4.8-rc2 next-20160815]
> > > > [if your patch is applied to the wrong git tree, please drop us a
> > > > note to help improve the system]
> > > 
> > > This is happening because scsi_is_sas_rphy wasn't designed to be 
> > > used outside the SAS transport class, so it's failing when the 
> > > ATTRs aren't defined.
> > > 
> > > This is the way you fix it (needs to be a precursor patch to 1/2):
> > > 
> > > James
> > 
> > Thanks, but I'm wondering about the call to sas_get_address(). It was
> > there before the patch as well and now it's an undefined reference. 
> > Am I missing something here? Sure it can be guarded in the #if block.
> 
> Yes: gcc is kind enough to elide any code that looks like
> 
> if (0) {
> 	refer to something
> }
> 
> So the static inline ensures anything within the brace isn't used as a
> linkable reference.

Aaahhh, that explains a lot.

Anyways, I've included get_sas_address() in the ifdef guard and
compile tested the new series with and with out
CONFIG_SCSI_SAS_ATTRS. Will send out shortly.
diff mbox

Patch

diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 13c0b2b..0e1c50e 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -15,8 +15,13 @@  static inline int is_sas_attached(struct scsi_device *sdev)
 {
 	return 0;
 }
+static inline int scsi_is_sas_rphy(const struct device *)
+{
+	return 0;
+}
 #else
 extern int is_sas_attached(struct scsi_device *sdev);
+extern int scsi_is_sas_rphy(const struct device *);
 #endif
 
 static inline int sas_protocol_ata(enum sas_protocol proto)
@@ -202,7 +207,6 @@  extern int sas_rphy_add(struct sas_rphy *);
 extern void sas_rphy_remove(struct sas_rphy *);
 extern void sas_rphy_delete(struct sas_rphy *);
 extern void sas_rphy_unlink(struct sas_rphy *);
-extern int scsi_is_sas_rphy(const struct device *);
 
 struct sas_port *sas_port_alloc(struct device *, int);
 struct sas_port *sas_port_alloc_num(struct device *);