aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-03-23 01:10:22 -0400
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-06-25 10:26:35 -0400
commit23d06ff700f546a6a1d63c85ade095dbd75b7ab5 (patch)
tree6aa1dc563be252b0e536944978f559ef984ba493 /drivers/char
parentec5fd99d3677efe5eebef3960168a1f9889322b9 (diff)
tpm: drop tpm_atmel specific fields from tpm_vendor_specific
Introduced a private struct tpm_atmel_priv that contains the variables have_region and region_size that were previously located in struct tpm_vendor_specific. These fields were only used by tpm_atmel. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm.h3
-rw-r--r--drivers/char/tpm/tpm_atmel.c18
-rw-r--r--drivers/char/tpm/tpm_atmel.h5
3 files changed, 19 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index f5e1846f4aaa..c5f8d9e4f953 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -136,9 +136,6 @@ struct tpm_vendor_specific {
136 136
137 int irq; 137 int irq;
138 138
139 int region_size;
140 int have_region;
141
142 struct list_head list; 139 struct list_head list;
143 int locality; 140 int locality;
144 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */ 141 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index a48a878f791d..0267d8587518 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -136,12 +136,13 @@ static struct platform_device *pdev;
136static void atml_plat_remove(void) 136static void atml_plat_remove(void)
137{ 137{
138 struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); 138 struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);
139 struct tpm_atmel_priv *priv = chip->vendor.priv;
139 140
140 if (chip) { 141 if (chip) {
141 tpm_chip_unregister(chip); 142 tpm_chip_unregister(chip);
142 if (chip->vendor.have_region) 143 if (priv->have_region)
143 atmel_release_region(chip->vendor.base, 144 atmel_release_region(chip->vendor.base,
144 chip->vendor.region_size); 145 priv->region_size);
145 atmel_put_base_addr(chip->vendor.iobase); 146 atmel_put_base_addr(chip->vendor.iobase);
146 platform_device_unregister(pdev); 147 platform_device_unregister(pdev);
147 } 148 }
@@ -163,6 +164,7 @@ static int __init init_atmel(void)
163 int have_region, region_size; 164 int have_region, region_size;
164 unsigned long base; 165 unsigned long base;
165 struct tpm_chip *chip; 166 struct tpm_chip *chip;
167 struct tpm_atmel_priv *priv;
166 168
167 rc = platform_driver_register(&atml_drv); 169 rc = platform_driver_register(&atml_drv);
168 if (rc) 170 if (rc)
@@ -183,6 +185,15 @@ static int __init init_atmel(void)
183 goto err_rel_reg; 185 goto err_rel_reg;
184 } 186 }
185 187
188 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
189 if (!priv) {
190 rc = -ENOMEM;
191 goto err_unreg_dev;
192 }
193
194 priv->have_region = have_region;
195 priv->region_size = region_size;
196
186 chip = tpmm_chip_alloc(&pdev->dev, &tpm_atmel); 197 chip = tpmm_chip_alloc(&pdev->dev, &tpm_atmel);
187 if (IS_ERR(chip)) { 198 if (IS_ERR(chip)) {
188 rc = PTR_ERR(chip); 199 rc = PTR_ERR(chip);
@@ -191,8 +202,7 @@ static int __init init_atmel(void)
191 202
192 chip->vendor.iobase = iobase; 203 chip->vendor.iobase = iobase;
193 chip->vendor.base = base; 204 chip->vendor.base = base;
194 chip->vendor.have_region = have_region; 205 chip->vendor.priv = priv;
195 chip->vendor.region_size = region_size;
196 206
197 rc = tpm_chip_register(chip); 207 rc = tpm_chip_register(chip);
198 if (rc) 208 if (rc)
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
index 6c831f9466b7..3fd929de9739 100644
--- a/drivers/char/tpm/tpm_atmel.h
+++ b/drivers/char/tpm/tpm_atmel.h
@@ -22,6 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25struct tpm_atmel_priv {
26 int region_size;
27 int have_region;
28};
29
25#ifdef CONFIG_PPC64 30#ifdef CONFIG_PPC64
26 31
27#include <asm/prom.h> 32#include <asm/prom.h>