forked from Minki/linux
drm/privacy_screen: Add drvdata in drm_privacy_screen
Allow a privacy screen provider to stash its private data pointer in the drm_privacy_screen, and update the drm_privacy_screen_register() call to accept that. Also introduce a *_get_drvdata() so that it can retrieved back when needed. This also touches the IBM Thinkpad platform driver, the only user of privacy screen today, to pass NULL for now to the updated API. Signed-off-by: Rajat Jain <rajatja@google.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220107190208.95479-1-rajatja@google.com
This commit is contained in:
parent
3dbc84a595
commit
30598d925d
@ -387,7 +387,8 @@ static void drm_privacy_screen_device_release(struct device *dev)
|
||||
* * An ERR_PTR(errno) on failure.
|
||||
*/
|
||||
struct drm_privacy_screen *drm_privacy_screen_register(
|
||||
struct device *parent, const struct drm_privacy_screen_ops *ops)
|
||||
struct device *parent, const struct drm_privacy_screen_ops *ops,
|
||||
void *data)
|
||||
{
|
||||
struct drm_privacy_screen *priv;
|
||||
int ret;
|
||||
@ -404,6 +405,7 @@ struct drm_privacy_screen *drm_privacy_screen_register(
|
||||
priv->dev.parent = parent;
|
||||
priv->dev.release = drm_privacy_screen_device_release;
|
||||
dev_set_name(&priv->dev, "privacy_screen-%s", dev_name(parent));
|
||||
priv->drvdata = data;
|
||||
priv->ops = ops;
|
||||
|
||||
priv->ops->get_hw_state(priv);
|
||||
@ -439,6 +441,7 @@ void drm_privacy_screen_unregister(struct drm_privacy_screen *priv)
|
||||
mutex_unlock(&drm_privacy_screen_devs_lock);
|
||||
|
||||
mutex_lock(&priv->lock);
|
||||
priv->drvdata = NULL;
|
||||
priv->ops = NULL;
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
|
@ -9782,7 +9782,7 @@ static int tpacpi_lcdshadow_init(struct ibm_init_struct *iibm)
|
||||
return 0;
|
||||
|
||||
lcdshadow_dev = drm_privacy_screen_register(&tpacpi_pdev->dev,
|
||||
&lcdshadow_ops);
|
||||
&lcdshadow_ops, NULL);
|
||||
if (IS_ERR(lcdshadow_dev))
|
||||
return PTR_ERR(lcdshadow_dev);
|
||||
|
||||
|
@ -73,10 +73,21 @@ struct drm_privacy_screen {
|
||||
* for more info.
|
||||
*/
|
||||
enum drm_privacy_screen_status hw_state;
|
||||
/**
|
||||
* @drvdata: Private data owned by the privacy screen provider
|
||||
*/
|
||||
void *drvdata;
|
||||
};
|
||||
|
||||
static inline
|
||||
void *drm_privacy_screen_get_drvdata(struct drm_privacy_screen *priv)
|
||||
{
|
||||
return priv->drvdata;
|
||||
}
|
||||
|
||||
struct drm_privacy_screen *drm_privacy_screen_register(
|
||||
struct device *parent, const struct drm_privacy_screen_ops *ops);
|
||||
struct device *parent, const struct drm_privacy_screen_ops *ops,
|
||||
void *data);
|
||||
void drm_privacy_screen_unregister(struct drm_privacy_screen *priv);
|
||||
|
||||
void drm_privacy_screen_call_notifier_chain(struct drm_privacy_screen *priv);
|
||||
|
Loading…
Reference in New Issue
Block a user