mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -34,4 +34,6 @@ void storage_ops_write(store_key_ops read)
|
||||
}
|
||||
#endif /*CONFIG_KEY_MANAGE*/
|
||||
|
||||
void *get_ukdev(void);
|
||||
|
||||
#endif /*__KEYMANAGE1__*/
|
||||
|
||||
Reference in New Issue
Block a user