diff mbox series

[v6,14/19] auxdisplay: ht16k33: Move delayed work

Message ID 20210914143835.511051-15-geert@linux-m68k.org
State New
Headers show
Series auxdisplay: ht16k33: Add character display support | expand

Commit Message

Geert Uytterhoeven Sept. 14, 2021, 2:38 p.m. UTC
Move delayed_work from ht16k33_fbdev to ht16k33_priv, as it is not
specific to dot-matrix displays, but common to all display types.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
v6:
  - No changes,

v5:
  - No changes,

v4:
  - No changes,

v3:
  - No changes,

v2:
  - No changes.
---
 drivers/auxdisplay/ht16k33.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Robin van der Gracht Sept. 30, 2021, 6:36 a.m. UTC | #1
Acked-by: Robin van der Gracht <robin@protonic.nl>


On 2021-09-14 16:38, Geert Uytterhoeven wrote:
> Move delayed_work from ht16k33_fbdev to ht16k33_priv, as it is not

> specific to dot-matrix displays, but common to all display types.

> 

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

> ---

> v6:

>   - No changes,

> 

> v5:

>   - No changes,

> 

> v4:

>   - No changes,

> 

> v3:

>   - No changes,

> 

> v2:

>   - No changes.

> ---

>  drivers/auxdisplay/ht16k33.c | 15 +++++++--------

>  1 file changed, 7 insertions(+), 8 deletions(-)

> 

> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c

> index 75d326a823543898..c7a3a0e1fbb5d03e 100644

> --- a/drivers/auxdisplay/ht16k33.c

> +++ b/drivers/auxdisplay/ht16k33.c

> @@ -65,11 +65,11 @@ struct ht16k33_fbdev {

>  	uint32_t refresh_rate;

>  	uint8_t *buffer;

>  	uint8_t *cache;

> -	struct delayed_work work;

>  };

> 

>  struct ht16k33_priv {

>  	struct i2c_client *client;

> +	struct delayed_work work;

>  	struct ht16k33_keypad keypad;

>  	struct ht16k33_fbdev fbdev;

>  };

> @@ -117,7 +117,7 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv)

>  {

>  	struct ht16k33_fbdev *fbdev = &priv->fbdev;

> 

> -	schedule_delayed_work(&fbdev->work, HZ / fbdev->refresh_rate);

> +	schedule_delayed_work(&priv->work, HZ / fbdev->refresh_rate);

>  }

> 

>  /*

> @@ -125,10 +125,9 @@ static void ht16k33_fb_queue(struct ht16k33_priv *priv)

>   */

>  static void ht16k33_fb_update(struct work_struct *work)

>  {

> -	struct ht16k33_fbdev *fbdev =

> -		container_of(work, struct ht16k33_fbdev, work.work);

> -	struct ht16k33_priv *priv =

> -		container_of(fbdev, struct ht16k33_priv, fbdev);

> +	struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv,

> +						 work.work);

> +	struct ht16k33_fbdev *fbdev = &priv->fbdev;

> 

>  	uint8_t *p1, *p2;

>  	int len, pos = 0, first = -1;

> @@ -462,7 +461,7 @@ static int ht16k33_probe(struct i2c_client *client)

>  	}

>  	fb_bl_default_curve(fbdev->info, 0, MIN_BRIGHTNESS, MAX_BRIGHTNESS);

> 

> -	INIT_DELAYED_WORK(&fbdev->work, ht16k33_fb_update);

> +	INIT_DELAYED_WORK(&priv->work, ht16k33_fb_update);

>  	fbdev->info->fbops = &ht16k33_fb_ops;

>  	fbdev->info->screen_base = (char __iomem *) fbdev->buffer;

>  	fbdev->info->screen_size = HT16K33_FB_SIZE;

> @@ -502,7 +501,7 @@ static int ht16k33_remove(struct i2c_client *client)

>  	struct ht16k33_priv *priv = i2c_get_clientdata(client);

>  	struct ht16k33_fbdev *fbdev = &priv->fbdev;

> 

> -	cancel_delayed_work_sync(&fbdev->work);

> +	cancel_delayed_work_sync(&priv->work);

>  	unregister_framebuffer(fbdev->info);

>  	framebuffer_release(fbdev->info);

>  	free_page((unsigned long) fbdev->buffer);
diff mbox series

Patch

diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
index 75d326a823543898..c7a3a0e1fbb5d03e 100644
--- a/drivers/auxdisplay/ht16k33.c
+++ b/drivers/auxdisplay/ht16k33.c
@@ -65,11 +65,11 @@  struct ht16k33_fbdev {
 	uint32_t refresh_rate;
 	uint8_t *buffer;
 	uint8_t *cache;
-	struct delayed_work work;
 };
 
 struct ht16k33_priv {
 	struct i2c_client *client;
+	struct delayed_work work;
 	struct ht16k33_keypad keypad;
 	struct ht16k33_fbdev fbdev;
 };
@@ -117,7 +117,7 @@  static void ht16k33_fb_queue(struct ht16k33_priv *priv)
 {
 	struct ht16k33_fbdev *fbdev = &priv->fbdev;
 
-	schedule_delayed_work(&fbdev->work, HZ / fbdev->refresh_rate);
+	schedule_delayed_work(&priv->work, HZ / fbdev->refresh_rate);
 }
 
 /*
@@ -125,10 +125,9 @@  static void ht16k33_fb_queue(struct ht16k33_priv *priv)
  */
 static void ht16k33_fb_update(struct work_struct *work)
 {
-	struct ht16k33_fbdev *fbdev =
-		container_of(work, struct ht16k33_fbdev, work.work);
-	struct ht16k33_priv *priv =
-		container_of(fbdev, struct ht16k33_priv, fbdev);
+	struct ht16k33_priv *priv = container_of(work, struct ht16k33_priv,
+						 work.work);
+	struct ht16k33_fbdev *fbdev = &priv->fbdev;
 
 	uint8_t *p1, *p2;
 	int len, pos = 0, first = -1;
@@ -462,7 +461,7 @@  static int ht16k33_probe(struct i2c_client *client)
 	}
 	fb_bl_default_curve(fbdev->info, 0, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
 
-	INIT_DELAYED_WORK(&fbdev->work, ht16k33_fb_update);
+	INIT_DELAYED_WORK(&priv->work, ht16k33_fb_update);
 	fbdev->info->fbops = &ht16k33_fb_ops;
 	fbdev->info->screen_base = (char __iomem *) fbdev->buffer;
 	fbdev->info->screen_size = HT16K33_FB_SIZE;
@@ -502,7 +501,7 @@  static int ht16k33_remove(struct i2c_client *client)
 	struct ht16k33_priv *priv = i2c_get_clientdata(client);
 	struct ht16k33_fbdev *fbdev = &priv->fbdev;
 
-	cancel_delayed_work_sync(&fbdev->work);
+	cancel_delayed_work_sync(&priv->work);
 	unregister_framebuffer(fbdev->info);
 	framebuffer_release(fbdev->info);
 	free_page((unsigned long) fbdev->buffer);