aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/tpm
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2018-12-20 20:55:33 +0000
committerConrad Meyer <cem@FreeBSD.org>2018-12-20 20:55:33 +0000
commit0c3bbec309a8ea169005002182c0765b4ca24d03 (patch)
tree3584c3da19fbc281dc1402960adc8af034f9bb72 /sys/dev/tpm
parent9877f73541e58b4588475d04dc9c964a091bebb1 (diff)
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
Notes
svn path=/head/; revision=342285
Diffstat (limited to 'sys/dev/tpm')
-rw-r--r--sys/dev/tpm/tpm20.c18
-rw-r--r--sys/dev/tpm/tpm20.h16
2 files changed, 17 insertions, 17 deletions
diff --git a/sys/dev/tpm/tpm20.c b/sys/dev/tpm/tpm20.c
index 5ad30c864260..7aebaad78440 100644
--- a/sys/dev/tpm/tpm20.c
+++ b/sys/dev/tpm/tpm20.c
@@ -36,6 +36,22 @@ MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2.0 driver");
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;
diff --git a/sys/dev/tpm/tpm20.h b/sys/dev/tpm/tpm20.h
index fcede6f1b605..b478f3d0eb22 100644
--- a/sys/dev/tpm/tpm20.h
+++ b/sys/dev/tpm/tpm20.h
@@ -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)