Commit 1b93d3cb authored by Danilo Krummrich's avatar Danilo Krummrich Committed by Liviu Dudau

drm/arm/malidp: replace drm->dev_private with drm_to_malidp()

Using drm_device->dev_private is deprecated. Since we've switched to
devm_drm_dev_alloc(), struct drm_device is now embedded in struct
malidp_drm, hence we can use container_of() to get the struct drm_device
instance instead.
Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
Signed-off-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026155934.125294-3-dakr@redhat.com
parent aefae871
...@@ -526,7 +526,7 @@ static const struct drm_crtc_funcs malidp_crtc_funcs = { ...@@ -526,7 +526,7 @@ static const struct drm_crtc_funcs malidp_crtc_funcs = {
int malidp_crtc_init(struct drm_device *drm) int malidp_crtc_init(struct drm_device *drm)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct drm_plane *primary = NULL, *plane; struct drm_plane *primary = NULL, *plane;
int ret; int ret;
......
...@@ -169,7 +169,7 @@ static void malidp_atomic_commit_se_config(struct drm_crtc *crtc, ...@@ -169,7 +169,7 @@ static void malidp_atomic_commit_se_config(struct drm_crtc *crtc,
*/ */
static int malidp_set_and_wait_config_valid(struct drm_device *drm) static int malidp_set_and_wait_config_valid(struct drm_device *drm)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
int ret; int ret;
...@@ -190,7 +190,7 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm) ...@@ -190,7 +190,7 @@ static int malidp_set_and_wait_config_valid(struct drm_device *drm)
static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
{ {
struct drm_device *drm = state->dev; struct drm_device *drm = state->dev;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
int loop = 5; int loop = 5;
malidp->event = malidp->crtc.state->event; malidp->event = malidp->crtc.state->event;
...@@ -231,7 +231,7 @@ static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) ...@@ -231,7 +231,7 @@ static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state)
static void malidp_atomic_commit_tail(struct drm_atomic_state *state) static void malidp_atomic_commit_tail(struct drm_atomic_state *state)
{ {
struct drm_device *drm = state->dev; struct drm_device *drm = state->dev;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state; struct drm_crtc_state *old_crtc_state;
int i; int i;
...@@ -393,7 +393,7 @@ static const struct drm_mode_config_funcs malidp_mode_config_funcs = { ...@@ -393,7 +393,7 @@ static const struct drm_mode_config_funcs malidp_mode_config_funcs = {
static int malidp_init(struct drm_device *drm) static int malidp_init(struct drm_device *drm)
{ {
int ret; int ret;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
drm_mode_config_init(drm); drm_mode_config_init(drm);
...@@ -429,7 +429,7 @@ static int malidp_irq_init(struct platform_device *pdev) ...@@ -429,7 +429,7 @@ static int malidp_irq_init(struct platform_device *pdev)
{ {
int irq_de, irq_se, ret = 0; int irq_de, irq_se, ret = 0;
struct drm_device *drm = dev_get_drvdata(&pdev->dev); struct drm_device *drm = dev_get_drvdata(&pdev->dev);
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
/* fetch the interrupts from DT */ /* fetch the interrupts from DT */
...@@ -463,7 +463,7 @@ static int malidp_dumb_create(struct drm_file *file_priv, ...@@ -463,7 +463,7 @@ static int malidp_dumb_create(struct drm_file *file_priv,
struct drm_device *drm, struct drm_device *drm,
struct drm_mode_create_dumb *args) struct drm_mode_create_dumb *args)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
/* allocate for the worst case scenario, i.e. rotated buffers */ /* allocate for the worst case scenario, i.e. rotated buffers */
u8 alignment = malidp_hw_get_pitch_align(malidp->dev, 1); u8 alignment = malidp_hw_get_pitch_align(malidp->dev, 1);
...@@ -509,7 +509,7 @@ static void malidp_error_stats_dump(const char *prefix, ...@@ -509,7 +509,7 @@ static void malidp_error_stats_dump(const char *prefix,
static int malidp_show_stats(struct seq_file *m, void *arg) static int malidp_show_stats(struct seq_file *m, void *arg)
{ {
struct drm_device *drm = m->private; struct drm_device *drm = m->private;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
unsigned long irqflags; unsigned long irqflags;
struct malidp_error_stats de_errors, se_errors; struct malidp_error_stats de_errors, se_errors;
...@@ -532,7 +532,7 @@ static ssize_t malidp_debugfs_write(struct file *file, const char __user *ubuf, ...@@ -532,7 +532,7 @@ static ssize_t malidp_debugfs_write(struct file *file, const char __user *ubuf,
{ {
struct seq_file *m = file->private_data; struct seq_file *m = file->private_data;
struct drm_device *drm = m->private; struct drm_device *drm = m->private;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&malidp->errors_lock, irqflags); spin_lock_irqsave(&malidp->errors_lock, irqflags);
...@@ -553,7 +553,7 @@ static const struct file_operations malidp_debugfs_fops = { ...@@ -553,7 +553,7 @@ static const struct file_operations malidp_debugfs_fops = {
static void malidp_debugfs_init(struct drm_minor *minor) static void malidp_debugfs_init(struct drm_minor *minor)
{ {
struct malidp_drm *malidp = minor->dev->dev_private; struct malidp_drm *malidp = drm_to_malidp(minor->dev);
malidp_error_stats_init(&malidp->de_errors); malidp_error_stats_init(&malidp->de_errors);
malidp_error_stats_init(&malidp->se_errors); malidp_error_stats_init(&malidp->se_errors);
...@@ -653,7 +653,7 @@ static ssize_t core_id_show(struct device *dev, struct device_attribute *attr, ...@@ -653,7 +653,7 @@ static ssize_t core_id_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct drm_device *drm = dev_get_drvdata(dev); struct drm_device *drm = dev_get_drvdata(dev);
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
return snprintf(buf, PAGE_SIZE, "%08x\n", malidp->core_id); return snprintf(buf, PAGE_SIZE, "%08x\n", malidp->core_id);
} }
...@@ -671,7 +671,7 @@ ATTRIBUTE_GROUPS(mali_dp); ...@@ -671,7 +671,7 @@ ATTRIBUTE_GROUPS(mali_dp);
static int malidp_runtime_pm_suspend(struct device *dev) static int malidp_runtime_pm_suspend(struct device *dev)
{ {
struct drm_device *drm = dev_get_drvdata(dev); struct drm_device *drm = dev_get_drvdata(dev);
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
/* we can only suspend if the hardware is in config mode */ /* we can only suspend if the hardware is in config mode */
...@@ -690,7 +690,7 @@ static int malidp_runtime_pm_suspend(struct device *dev) ...@@ -690,7 +690,7 @@ static int malidp_runtime_pm_suspend(struct device *dev)
static int malidp_runtime_pm_resume(struct device *dev) static int malidp_runtime_pm_resume(struct device *dev)
{ {
struct drm_device *drm = dev_get_drvdata(dev); struct drm_device *drm = dev_get_drvdata(dev);
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
clk_prepare_enable(hwdev->pclk); clk_prepare_enable(hwdev->pclk);
...@@ -756,7 +756,6 @@ static int malidp_bind(struct device *dev) ...@@ -756,7 +756,6 @@ static int malidp_bind(struct device *dev)
if (ret && ret != -ENODEV) if (ret && ret != -ENODEV)
return ret; return ret;
drm->dev_private = malidp;
dev_set_drvdata(dev, drm); dev_set_drvdata(dev, drm);
/* Enable power management */ /* Enable power management */
...@@ -882,7 +881,6 @@ static int malidp_bind(struct device *dev) ...@@ -882,7 +881,6 @@ static int malidp_bind(struct device *dev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
else else
malidp_runtime_pm_suspend(dev); malidp_runtime_pm_suspend(dev);
drm->dev_private = NULL;
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
of_reserved_mem_device_release(dev); of_reserved_mem_device_release(dev);
...@@ -892,7 +890,7 @@ static int malidp_bind(struct device *dev) ...@@ -892,7 +890,7 @@ static int malidp_bind(struct device *dev)
static void malidp_unbind(struct device *dev) static void malidp_unbind(struct device *dev)
{ {
struct drm_device *drm = dev_get_drvdata(dev); struct drm_device *drm = dev_get_drvdata(dev);
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
drm_dev_unregister(drm); drm_dev_unregister(drm);
...@@ -910,7 +908,6 @@ static void malidp_unbind(struct device *dev) ...@@ -910,7 +908,6 @@ static void malidp_unbind(struct device *dev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
else else
malidp_runtime_pm_suspend(dev); malidp_runtime_pm_suspend(dev);
drm->dev_private = NULL;
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
of_reserved_mem_device_release(dev); of_reserved_mem_device_release(dev);
} }
......
...@@ -45,6 +45,7 @@ struct malidp_drm { ...@@ -45,6 +45,7 @@ struct malidp_drm {
#endif #endif
}; };
#define drm_to_malidp(x) container_of(x, struct malidp_drm, base)
#define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc) #define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc)
struct malidp_plane { struct malidp_plane {
......
...@@ -1168,7 +1168,7 @@ static void malidp_hw_clear_irq(struct malidp_hw_device *hwdev, u8 block, u32 ir ...@@ -1168,7 +1168,7 @@ static void malidp_hw_clear_irq(struct malidp_hw_device *hwdev, u8 block, u32 ir
static irqreturn_t malidp_de_irq(int irq, void *arg) static irqreturn_t malidp_de_irq(int irq, void *arg)
{ {
struct drm_device *drm = arg; struct drm_device *drm = arg;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev; struct malidp_hw_device *hwdev;
struct malidp_hw *hw; struct malidp_hw *hw;
const struct malidp_irq_map *de; const struct malidp_irq_map *de;
...@@ -1226,7 +1226,7 @@ static irqreturn_t malidp_de_irq(int irq, void *arg) ...@@ -1226,7 +1226,7 @@ static irqreturn_t malidp_de_irq(int irq, void *arg)
static irqreturn_t malidp_de_irq_thread_handler(int irq, void *arg) static irqreturn_t malidp_de_irq_thread_handler(int irq, void *arg)
{ {
struct drm_device *drm = arg; struct drm_device *drm = arg;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
wake_up(&malidp->wq); wake_up(&malidp->wq);
...@@ -1252,7 +1252,7 @@ void malidp_de_irq_hw_init(struct malidp_hw_device *hwdev) ...@@ -1252,7 +1252,7 @@ void malidp_de_irq_hw_init(struct malidp_hw_device *hwdev)
int malidp_de_irq_init(struct drm_device *drm, int irq) int malidp_de_irq_init(struct drm_device *drm, int irq)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
int ret; int ret;
...@@ -1286,7 +1286,7 @@ void malidp_de_irq_fini(struct malidp_hw_device *hwdev) ...@@ -1286,7 +1286,7 @@ void malidp_de_irq_fini(struct malidp_hw_device *hwdev)
static irqreturn_t malidp_se_irq(int irq, void *arg) static irqreturn_t malidp_se_irq(int irq, void *arg)
{ {
struct drm_device *drm = arg; struct drm_device *drm = arg;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
struct malidp_hw *hw = hwdev->hw; struct malidp_hw *hw = hwdev->hw;
const struct malidp_irq_map *se = &hw->map.se_irq_map; const struct malidp_irq_map *se = &hw->map.se_irq_map;
...@@ -1363,7 +1363,7 @@ static irqreturn_t malidp_se_irq_thread_handler(int irq, void *arg) ...@@ -1363,7 +1363,7 @@ static irqreturn_t malidp_se_irq_thread_handler(int irq, void *arg)
int malidp_se_irq_init(struct drm_device *drm, int irq) int malidp_se_irq_init(struct drm_device *drm, int irq)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
int ret; int ret;
......
...@@ -129,7 +129,7 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder, ...@@ -129,7 +129,7 @@ malidp_mw_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
struct malidp_mw_connector_state *mw_state = to_mw_state(conn_state); struct malidp_mw_connector_state *mw_state = to_mw_state(conn_state);
struct malidp_drm *malidp = encoder->dev->dev_private; struct malidp_drm *malidp = drm_to_malidp(encoder->dev);
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
int i, n_planes; int i, n_planes;
...@@ -207,7 +207,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats) ...@@ -207,7 +207,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats)
int malidp_mw_connector_init(struct drm_device *drm) int malidp_mw_connector_init(struct drm_device *drm)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
u32 *formats; u32 *formats;
int ret, n_formats; int ret, n_formats;
...@@ -236,7 +236,7 @@ int malidp_mw_connector_init(struct drm_device *drm) ...@@ -236,7 +236,7 @@ int malidp_mw_connector_init(struct drm_device *drm)
void malidp_mw_atomic_commit(struct drm_device *drm, void malidp_mw_atomic_commit(struct drm_device *drm,
struct drm_atomic_state *old_state) struct drm_atomic_state *old_state)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
struct drm_writeback_connector *mw_conn = &malidp->mw_connector; struct drm_writeback_connector *mw_conn = &malidp->mw_connector;
struct drm_connector_state *conn_state = mw_conn->base.state; struct drm_connector_state *conn_state = mw_conn->base.state;
struct malidp_hw_device *hwdev = malidp->dev; struct malidp_hw_device *hwdev = malidp->dev;
......
...@@ -151,7 +151,7 @@ bool malidp_format_mod_supported(struct drm_device *drm, ...@@ -151,7 +151,7 @@ bool malidp_format_mod_supported(struct drm_device *drm,
{ {
const struct drm_format_info *info; const struct drm_format_info *info;
const u64 *modifiers; const u64 *modifiers;
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
const struct malidp_hw_regmap *map = &malidp->dev->hw->map; const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID)) if (WARN_ON(modifier == DRM_FORMAT_MOD_INVALID))
...@@ -931,7 +931,7 @@ static const uint64_t linear_only_modifiers[] = { ...@@ -931,7 +931,7 @@ static const uint64_t linear_only_modifiers[] = {
int malidp_de_planes_init(struct drm_device *drm) int malidp_de_planes_init(struct drm_device *drm)
{ {
struct malidp_drm *malidp = drm->dev_private; struct malidp_drm *malidp = drm_to_malidp(drm);
const struct malidp_hw_regmap *map = &malidp->dev->hw->map; const struct malidp_hw_regmap *map = &malidp->dev->hw->map;
struct malidp_plane *plane = NULL; struct malidp_plane *plane = NULL;
enum drm_plane_type plane_type; enum drm_plane_type plane_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment