diff mbox series

[v3,3/9] drm/mipi-dsi: mipi_dsi_*_write functions don't need to ratelimit prints

Message ID 20240501084109.v3.3.I9982cd5d8014de7a4513f5619f66f88da49ce4ec@changeid (mailing list archive)
State New, archived
Headers show
Series drm/mipi-dsi: Reduce bloat and add funcs for cleaner init seqs | expand

Commit Message

Douglas Anderson May 1, 2024, 3:41 p.m. UTC
We really don't expect these errors to be printed over and over
again. When a driver hits the error it should bail out. Just use a
normal error print.

This gives a nice space savings for users of these functions:

$ scripts/bloat-o-meter \
  .../before/panel-novatek-nt36672e.ko \
  .../after/panel-novatek-nt36672e.ko
add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-16760 (-16760)
Function                                     old     new   delta
nt36672e_1080x2408_60hz_init               17080   10640   -6440
nt36672e_1080x2408_60hz_init._rs           10320       -  -10320
Total: Before=31815, After=15055, chg -52.68%

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v3:
- ("mipi_dsi_*_write functions don't need to ratelimit...") moved earlier.

Changes in v2:
- New

 include/drm/drm_mipi_dsi.h | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

Comments

Neil Armstrong May 2, 2024, 7:27 a.m. UTC | #1
On 01/05/2024 17:41, Douglas Anderson wrote:
> We really don't expect these errors to be printed over and over
> again. When a driver hits the error it should bail out. Just use a
> normal error print.
> 
> This gives a nice space savings for users of these functions:
> 
> $ scripts/bloat-o-meter \
>    .../before/panel-novatek-nt36672e.ko \
>    .../after/panel-novatek-nt36672e.ko
> add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-16760 (-16760)
> Function                                     old     new   delta
> nt36672e_1080x2408_60hz_init               17080   10640   -6440
> nt36672e_1080x2408_60hz_init._rs           10320       -  -10320
> Total: Before=31815, After=15055, chg -52.68%
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
> Changes in v3:
> - ("mipi_dsi_*_write functions don't need to ratelimit...") moved earlier.
> 
> Changes in v2:
> - New
> 
>   include/drm/drm_mipi_dsi.h | 24 +++++++++++-------------
>   1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index e0f56564bf97..67967be48dbd 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -314,17 +314,16 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
>    * @dsi: DSI peripheral device
>    * @seq: buffer containing the payload
>    */
> -#define mipi_dsi_generic_write_seq(dsi, seq...)                                 \
> -	do {                                                                    \
> -		static const u8 d[] = { seq };                                  \
> -		struct device *dev = &dsi->dev;                                 \
> -		ssize_t ret;                                                    \
> -		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));            \
> -		if (ret < 0) {                                                  \
> -			dev_err_ratelimited(dev, "transmit data failed: %zd\n", \
> -					    ret);                               \
> -			return ret;                                             \
> -		}                                                               \
> +#define mipi_dsi_generic_write_seq(dsi, seq...)                           \
> +	do {                                                              \
> +		static const u8 d[] = { seq };                            \
> +		struct device *dev = &dsi->dev;                           \
> +		ssize_t ret;                                              \
> +		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));      \
> +		if (ret < 0) {                                            \
> +			dev_err(dev, "transmit data failed: %zd\n", ret); \
> +			return ret;                                       \
> +		}                                                         \
>   	} while (0)
>   
>   /**
> @@ -340,8 +339,7 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
>   		ssize_t ret;                                                \
>   		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));     \
>   		if (ret < 0) {                                              \
> -			dev_err_ratelimited(                                \
> -				dev, "sending command %#02x failed: %zd\n", \
> +			dev_err(dev, "sending command %#02x failed: %zd\n", \
>   				cmd, ret);                                  \
>   			return ret;                                         \
>   		}                                                           \

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Linus Walleij May 2, 2024, 8:16 a.m. UTC | #2
On Wed, May 1, 2024 at 5:43 PM Douglas Anderson <dianders@chromium.org> wrote:

> We really don't expect these errors to be printed over and over
> again. When a driver hits the error it should bail out. Just use a
> normal error print.
>
> This gives a nice space savings for users of these functions:
>
> $ scripts/bloat-o-meter \
>   .../before/panel-novatek-nt36672e.ko \
>   .../after/panel-novatek-nt36672e.ko
> add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-16760 (-16760)
> Function                                     old     new   delta
> nt36672e_1080x2408_60hz_init               17080   10640   -6440
> nt36672e_1080x2408_60hz_init._rs           10320       -  -10320
> Total: Before=31815, After=15055, chg -52.68%
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

OK then!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index e0f56564bf97..67967be48dbd 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -314,17 +314,16 @@  int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
  * @dsi: DSI peripheral device
  * @seq: buffer containing the payload
  */
-#define mipi_dsi_generic_write_seq(dsi, seq...)                                 \
-	do {                                                                    \
-		static const u8 d[] = { seq };                                  \
-		struct device *dev = &dsi->dev;                                 \
-		ssize_t ret;                                                    \
-		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));            \
-		if (ret < 0) {                                                  \
-			dev_err_ratelimited(dev, "transmit data failed: %zd\n", \
-					    ret);                               \
-			return ret;                                             \
-		}                                                               \
+#define mipi_dsi_generic_write_seq(dsi, seq...)                           \
+	do {                                                              \
+		static const u8 d[] = { seq };                            \
+		struct device *dev = &dsi->dev;                           \
+		ssize_t ret;                                              \
+		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));      \
+		if (ret < 0) {                                            \
+			dev_err(dev, "transmit data failed: %zd\n", ret); \
+			return ret;                                       \
+		}                                                         \
 	} while (0)
 
 /**
@@ -340,8 +339,7 @@  int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
 		ssize_t ret;                                                \
 		ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d));     \
 		if (ret < 0) {                                              \
-			dev_err_ratelimited(                                \
-				dev, "sending command %#02x failed: %zd\n", \
+			dev_err(dev, "sending command %#02x failed: %zd\n", \
 				cmd, ret);                                  \
 			return ret;                                         \
 		}                                                           \