unsigned int mdigest[5];
};
-static struct miscdevice mdev;
+static struct dw_hdcp *g_hdcp;
static inline unsigned int shacircularshift(unsigned int bits,
unsigned int word)
struct device_attribute *attr, char *buf)
{
int enable = 0;
- struct dw_hdcp *hdcp = dev_get_drvdata(device);
+ struct dw_hdcp *hdcp = g_hdcp;
if (hdcp)
enable = hdcp->enable;
const char *buf, size_t count)
{
int enable;
- struct dw_hdcp *hdcp = dev_get_drvdata(device);
+ struct dw_hdcp *hdcp = g_hdcp;
if (!hdcp)
return -EINVAL;
struct device_attribute *attr, char *buf)
{
int trytimes = 0;
- struct dw_hdcp *hdcp = dev_get_drvdata(device);
+ struct dw_hdcp *hdcp = g_hdcp;
if (hdcp)
trytimes = hdcp->retry_times;
const char *buf, size_t count)
{
int trytimes;
- struct dw_hdcp *hdcp = dev_get_drvdata(device);
+ struct dw_hdcp *hdcp = g_hdcp;
if (!hdcp)
return -EINVAL;
struct device_attribute *attr, char *buf)
{
int status = DW_HDCP_DISABLED;
- struct dw_hdcp *hdcp = dev_get_drvdata(device);
+ struct dw_hdcp *hdcp = g_hdcp;
if (hdcp)
status = hdcp->status;
int ret = 0;
struct dw_hdcp *hdcp = pdev->dev.platform_data;
- mdev.minor = MISC_DYNAMIC_MINOR;
- mdev.name = "hdmi_hdcp1x";
- mdev.mode = 0666;
+ g_hdcp = hdcp;
+ hdcp->mdev.minor = MISC_DYNAMIC_MINOR;
+ hdcp->mdev.name = "hdmi_hdcp1x";
+ hdcp->mdev.mode = 0666;
- if (misc_register(&mdev)) {
+ if (misc_register(&hdcp->mdev)) {
dev_err(&pdev->dev, "HDCP: Could not add character driver\n");
return -EINVAL;
}
- ret = device_create_file(mdev.this_device, &dev_attr_enable);
+ ret = device_create_file(hdcp->mdev.this_device, &dev_attr_enable);
if (ret) {
dev_err(&pdev->dev, "HDCP: Could not add sys file enable\n");
ret = -EINVAL;
goto error0;
}
- ret = device_create_file(mdev.this_device, &dev_attr_trytimes);
+ ret = device_create_file(hdcp->mdev.this_device, &dev_attr_trytimes);
if (ret) {
dev_err(&pdev->dev, "HDCP: Could not add sys file trytimes\n");
ret = -EINVAL;
goto error1;
}
- ret = device_create_file(mdev.this_device, &dev_attr_status);
+ ret = device_create_file(hdcp->mdev.this_device, &dev_attr_status);
if (ret) {
dev_err(&pdev->dev, "HDCP: Could not add sys file status\n");
ret = -EINVAL;
goto error2;
}
- dev_set_drvdata(mdev.this_device, hdcp);
if (!(hdcp->read(hdcp->hdmi, HDMI_MC_CLKDIS) &
HDMI_MC_CLKDIS_HDCPCLK_MASK))
return 0;
error2:
- device_remove_file(mdev.this_device, &dev_attr_trytimes);
+ device_remove_file(hdcp->mdev.this_device, &dev_attr_trytimes);
error1:
- device_remove_file(mdev.this_device, &dev_attr_enable);
+ device_remove_file(hdcp->mdev.this_device, &dev_attr_enable);
error0:
- misc_deregister(&mdev);
+ misc_deregister(&hdcp->mdev);
return ret;
}
{
struct dw_hdcp *hdcp = pdev->dev.platform_data;
- device_remove_file(mdev.this_device, &dev_attr_trytimes);
- device_remove_file(mdev.this_device, &dev_attr_enable);
- device_remove_file(mdev.this_device, &dev_attr_status);
- misc_deregister(&mdev);
+ device_remove_file(hdcp->mdev.this_device, &dev_attr_trytimes);
+ device_remove_file(hdcp->mdev.this_device, &dev_attr_enable);
+ device_remove_file(hdcp->mdev.this_device, &dev_attr_status);
+ misc_deregister(&hdcp->mdev);
kfree(hdcp->keys);
kfree(hdcp->seeds);