Subject: Re: Build failure for src/sys/dev/pci/amdpm_smbus.c
To: None <current-users@netbsd.org>
From: Paul Goyette <paul@whooppee.com>
List: current-users
Date: 02/06/2007 06:03:50
On Tue, 6 Feb 2007, Paul Goyette wrote:

>>> /usr/src/sys/dev/pci/amdpm_smbus.c: In function 'amdpm_smbus_attach':
>>> /usr/src/sys/dev/pci/amdpm_smbus.c:82: warning: unused variable 'intrstr'
>>> /usr/src/sys/dev/pci/amdpm_smbus.c:81: warning: unused variable 'ih'
>> 
>> Got the same error while building port-amd64 GENERIC_ACPI and GENERIC.MP 
>> kernels, so it's probably not port-specific.
>
> These two variables appear to be used only inside the the #ifdef XBOX block, 
> so the following patch seems to be in order here...

Previous patch was insufficient, since amdpm_smbus_intr() is defined 
static, but also only used if XBOX is defined.  So we need the following 
more extensive patch:

Index: amdpm_smbus.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/amdpm_smbus.c,v
retrieving revision 1.11
diff -u -p -r1.11 amdpm_smbus.c
--- amdpm_smbus.c	6 Feb 2007 02:07:36 -0000	1.11
+++ amdpm_smbus.c	6 Feb 2007 14:01:12 -0000
@@ -72,14 +72,18 @@ static int       amdpm_smbus_write_1(str
  static int       amdpm_smbus_receive_1(struct amdpm_softc *sc, i2c_op_t op);
  static int       amdpm_smbus_read_1(struct amdpm_softc *sc, u_int8_t cmd, i2c_op_t op);

+#ifdef XBOX
  static int	 amdpm_smbus_intr(void *);
+#endif

  void
  amdpm_smbus_attach(struct amdpm_softc *sc)
  {
          struct i2cbus_attach_args iba;
+#ifdef XBOX
  	pci_intr_handle_t ih;
  	const char *intrstr;
+#endif

  	/* register with iic */
  	sc->sc_i2c.ic_cookie = sc; 
@@ -136,10 +140,10 @@ amdpm_smbus_attach(struct amdpm_softc *s
  	(void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print);
  }

+#ifdef XBOX
  static int
  amdpm_smbus_intr(void *cookie)
  {
-#ifdef XBOX
  	struct amdpm_softc *sc;
  	uint32_t status;

@@ -152,9 +156,9 @@ amdpm_smbus_intr(void *cookie)
  		if (status & 2)
  			return iic_smbus_intr(&sc->sc_i2c);
  	}
-#endif
  	return 0;
  }
+#endif

  static int
  amdpm_smbus_acquire_bus(void *cookie, int flags)

----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Network Engineer | FA29 0E3B 35AF E8AE 6651 |  paul@whooppee.com   |
|                  | 0786 F758 55DE 53BA 7731 | pgoyette@juniper.net |
----------------------------------------------------------------------