svn commit: r342285 - head/sys/dev/tpm

Conrad Meyer cem at FreeBSD.org
Thu Dec 20 20:55:34 UTC 2018


Author: cem
Date: Thu Dec 20 20:55:33 2018
New Revision: 342285
URL: https://svnweb.freebsd.org/changeset/base/342285

Log:
  tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
  
  Move static variable definition (cdevsw) to a more conventional location
  (the C file it is used in), rather than a header.
  
  This fixes the GCC warning, -Wunused-variable ("defined but not used") when
  the tpm20.h header is included in files other than tpm20.c (e.g.,
  tpm_tis.c).
  
  X-MFC-with:	r342084
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/dev/tpm/tpm20.c
  head/sys/dev/tpm/tpm20.h

Modified: head/sys/dev/tpm/tpm20.c
==============================================================================
--- head/sys/dev/tpm/tpm20.c	Thu Dec 20 20:34:21 2018	(r342284)
+++ head/sys/dev/tpm/tpm20.c	Thu Dec 20 20:55:33 2018	(r342285)
@@ -36,6 +36,22 @@ MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2
 static void tpm20_discard_buffer(void *arg);
 static int tpm20_save_state(device_t dev, bool suspend);
 
+static d_open_t		tpm20_open;
+static d_close_t	tpm20_close;
+static d_read_t		tpm20_read;
+static d_write_t	tpm20_write;
+static d_ioctl_t	tpm20_ioctl;
+
+static struct cdevsw tpm20_cdevsw = {
+	.d_version = D_VERSION,
+	.d_open = tpm20_open,
+	.d_close = tpm20_close,
+	.d_read = tpm20_read,
+	.d_write = tpm20_write,
+	.d_ioctl = tpm20_ioctl,
+	.d_name = "tpm20",
+};
+
 int
 tpm20_read(struct cdev *dev, struct uio *uio, int flags)
 {
@@ -162,7 +178,7 @@ tpm20_init(struct tpm_sc *sc)
 	sc->pending_data_length = 0;
 
 	make_dev_args_init(&args);
-	args.mda_devsw = &tpm_cdevsw;
+	args.mda_devsw = &tpm20_cdevsw;
 	args.mda_uid = UID_ROOT;
 	args.mda_gid = GID_WHEEL;
 	args.mda_mode = TPM_CDEV_PERM_FLAG;

Modified: head/sys/dev/tpm/tpm20.h
==============================================================================
--- head/sys/dev/tpm/tpm20.h	Thu Dec 20 20:34:21 2018	(r342284)
+++ head/sys/dev/tpm/tpm20.h	Thu Dec 20 20:55:33 2018	(r342285)
@@ -124,22 +124,6 @@ int32_t tpm20_get_timeout(uint32_t command);
 int tpm20_init(struct tpm_sc *sc);
 void tpm20_release(struct tpm_sc *sc);
 
-d_open_t	tpm20_open;
-d_close_t	tpm20_close;
-d_read_t	tpm20_read;
-d_write_t	tpm20_write;
-d_ioctl_t	tpm20_ioctl;
-
-static struct cdevsw tpm_cdevsw = {
-	.d_version = D_VERSION,
-	.d_open = tpm20_open,
-	.d_close = tpm20_close,
-	.d_read = tpm20_read,
-	.d_write = tpm20_write,
-	.d_ioctl = tpm20_ioctl,
-	.d_name = "tpm20",
-};
-
 /* Small helper routines for io ops */
 static inline uint8_t
 RD1(struct tpm_sc *sc, bus_size_t off)


More information about the svn-src-all mailing list