unifykey: add helper API so we can call unifykey APIs from drivers [4/5]

PD#165222: crash if call unifykey APIs from other drivers

example to call unifykey APIs from kernel space:

  ret = key_unify_query(get_ukdev(), key_name, &key_exist, &keypermit);

Change-Id: I2e7f6cdad21c9faa4d95d0536b187ece485a5b46
Signed-off-by: jiamin ma <jiamin.ma@amlogic.com>
This commit is contained in:
jiamin ma
2018-04-26 14:59:00 +08:00
committed by Yixun Lan
parent 9a016e699d
commit 7771f2cbe3
2 changed files with 9 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ typedef int (*key_unify_dev_init)(struct key_info_t *uk_info,
typedef int (*key_unify_dev_uninit)(void);
static int module_init_flag;
static struct aml_unifykey_dev *ukdev_global;
static char hex_to_asc(char para)
{
@@ -899,6 +900,11 @@ static long unifykey_compat_ioctl(struct file *file,
}
#endif
void *get_ukdev(void)
{
return ukdev_global;
}
static ssize_t unifykey_read(struct file *file,
char __user *buf,
size_t count,
@@ -1523,6 +1529,7 @@ static int aml_unifykeys_probe(struct platform_device *pdev)
ret = -ENOMEM;
goto out;
}
ukdev_global = ukdev;
ukdev->pdev = pdev;
platform_set_drvdata(pdev, ukdev);

View File

@@ -34,4 +34,6 @@ void storage_ops_write(store_key_ops read)
}
#endif /*CONFIG_KEY_MANAGE*/
void *get_ukdev(void);
#endif /*__KEYMANAGE1__*/