[v4,01/10] drm/print: Fix and add support for NULL as first argument in drm_* macros

Message ID 7acc7401b5ad0aec973948822bfa906a9615c43e.1672957022.git.code@siddh.me
State New
Headers
Series drm: Remove usage of deprecated DRM_* macros |

Commit Message

Siddh Raman Pant Jan. 5, 2023, 10:24 p.m. UTC
  Comments say macros DRM_DEBUG_* are deprecated in favor of
drm_dbg_*(NULL, ...), but they have broken support for it,
as the macro will result in `(NULL) ? (NULL)->dev : NULL`.

Thus, fix them by separating logic to get dev ptr in a new
function, which will return the dev ptr if arg is not NULL.
Use it in drm_dbg_*, and also in __DRM_DEFINE_DBG_RATELIMITED,
where a similar (but correct) NULL check was in place.

Also, add support for NULL in __drm_printk, so that all the
drm_* macros will hence support NULL as the first argument.
This also means that deprecation comments mentioning pr_()*
can now be changed to the drm equivalents.

There is a need to support device pointers, as in some cases,
we may not have drm_device but just the device ptr, such as
when dealing with struct mipi_dsi_host. Before this change,
passing just mipi_dsi_host would have worked, since due to
preprocessing, the resultant would be "host->dev", but now
due to NULL check that cannot happen.

Signed-off-by: Siddh Raman Pant <code@siddh.me>
---
 include/drm/drm_print.h | 101 +++++++++++++++++++++++++++++-----------
 1 file changed, 73 insertions(+), 28 deletions(-)
  

Comments

kernel test robot Jan. 6, 2023, 1:13 a.m. UTC | #1
Hi Siddh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.2-rc2 next-20230105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/7acc7401b5ad0aec973948822bfa906a9615c43e.1672957022.git.code%40siddh.me
patch subject: [PATCH v4 01/10] drm/print: Fix and add support for NULL as first argument in drm_* macros
config: m68k-allmodconfig
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/8b796b03036f712417f8a87f85cdf9ac66d736ac
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
        git checkout 8b796b03036f712417f8a87f85cdf9ac66d736ac
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/gpu/drm/display/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

         |         ^~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:849:17: note: in expansion of macro 'drm_err'
     849 |                 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n",
         |                 ^~~~~~~
   include/drm/drm_print.h:480:9: warning: initialization of 'struct device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     480 |         _Generic((drm),                                                 \
         |         ^~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:857:17: note: in expansion of macro 'drm_err'
     857 |                 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n",
         |                 ^~~~~~~
   include/drm/drm_print.h:480:9: warning: initialization of 'struct device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     480 |         _Generic((drm),                                                 \
         |         ^~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:864:17: note: in expansion of macro 'drm_err'
     864 |                 drm_err(aux->drm_dev, "%s: DPCD failed write at register 0x%x\n",
         |                 ^~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c: In function 'drm_dp_read_extended_dpcd_caps':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:908:17: note: in expansion of macro 'drm_dbg_kms'
     908 |                 drm_dbg_kms(aux->drm_dev,
         |                 ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:917:9: note: in expansion of macro 'drm_dbg_kms'
     917 |         drm_dbg_kms(aux->drm_dev, "%s: Base DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd);
         |         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/display/drm_dp_helper.c: In function 'drm_dp_read_dpcd_caps':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:952:9: note: in expansion of macro 'drm_dbg_kms'
     952 |         drm_dbg_kms(aux->drm_dev, "%s: DPCD: %*ph\n", aux->name, DP_RECEIVER_CAP_SIZE, dpcd);
         |         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/display/drm_dp_helper.c: In function 'drm_dp_read_downstream_info':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1001:9: note: in expansion of macro 'drm_dbg_kms'
    1001 |         drm_dbg_kms(aux->drm_dev, "%s: DPCD DFP: %*ph\n", aux->name, len, downstream_ports);
         |         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/display/drm_dp_helper.c: In function 'drm_dp_i2c_do_msg':
>> include/drm/drm_print.h:482:25: warning: passing argument 1 of 'drm_dev_printk' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:646:32: note: in expansion of macro '__drm_get_dev_ptr'
     646 |                 drm_dev_printk(__drm_get_dev_ptr(drm), KERN_DEBUG,      \
         |                                ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:651:9: note: in expansion of macro '__DRM_DEFINE_DBG_RATELIMITED'
     651 |         __DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1718:33: note: in expansion of macro 'drm_dbg_kms_ratelimited'
    1718 |                                 drm_dbg_kms_ratelimited(aux->drm_dev, "%s: transaction timed out\n",
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:356:42: note: expected 'const struct device *' but argument is of type 'int'
     356 | void drm_dev_printk(const struct device *dev, const char *level,
         |                     ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1721:33: note: in expansion of macro 'drm_dbg_kms'
    1721 |                                 drm_dbg_kms(aux->drm_dev, "%s: transaction failed: %d\n",
         |                                 ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1736:25: note: in expansion of macro 'drm_dbg_kms'
    1736 |                         drm_dbg_kms(aux->drm_dev, "%s: native nack (result=%d, size=%zu)\n",
         |                         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1741:25: note: in expansion of macro 'drm_dbg_kms'
    1741 |                         drm_dbg_kms(aux->drm_dev, "%s: native defer\n", aux->name);
         |                         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:480:9: warning: initialization of 'struct device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     480 |         _Generic((drm),                                                 \
         |         ^~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1755:25: note: in expansion of macro 'drm_err'
    1755 |                         drm_err(aux->drm_dev, "%s: invalid native reply %#04x\n",
         |                         ^~~~~~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:538:21: note: in expansion of macro '__drm_get_dev_ptr'
     538 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/display/drm_dp_helper.c:1771:25: note: in expansion of macro 'drm_dbg_kms'
    1771 |                         drm_dbg_kms(aux->drm_dev, "%s: I2C nack (result=%d, size=%zu)\n",
         |                         ^~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |


vim +/drm_dev_printk +482 include/drm/drm_print.h

   473	
   474	/**
   475	 * __drm_get_dev_ptr - Helper to get device pointer even if NULL is passed.
   476	 *		       Primarily for use in drm_*() print macros, since they
   477	 *		       need to handle NULL as the first argument passed.
   478	 */
   479	#define  __drm_get_dev_ptr(drm) \
   480		_Generic((drm),							\
   481			struct drm_device * :					\
 > 482				__drm_get_dev_ptr((drm), true),			\
   483			struct device * :					\
   484				__drm_get_dev_ptr((drm), false),		\
   485			default :						\
   486				NULL						\
   487		)
   488
  
kernel test robot Jan. 6, 2023, 1:54 a.m. UTC | #2
Hi Siddh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.2-rc2 next-20230105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/7acc7401b5ad0aec973948822bfa906a9615c43e.1672957022.git.code%40siddh.me
patch subject: [PATCH v4 01/10] drm/print: Fix and add support for NULL as first argument in drm_* macros
config: ia64-allyesconfig
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/8b796b03036f712417f8a87f85cdf9ac66d736ac
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
        git checkout 8b796b03036f712417f8a87f85cdf9ac66d736ac
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/drm_atomic.c:43:
   drivers/gpu/drm/drm_atomic.c: In function 'drm_crtc_commit_wait':
   include/drm/drm_print.h:482:25: error: implicit declaration of function '__drm_get_dev_ptr'; did you mean '___drm_get_dev_ptr'? [-Werror=implicit-function-declaration]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:79:17: note: in expansion of macro 'drm_err'
      79 |                 drm_err(commit->crtc->dev, "hw_done timed out\n");
         |                 ^~~~~~~
>> include/drm/drm_print.h:480:9: warning: initialization of 'struct device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     480 |         _Generic((drm),                                                 \
         |         ^~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:79:17: note: in expansion of macro 'drm_err'
      79 |                 drm_err(commit->crtc->dev, "hw_done timed out\n");
         |                 ^~~~~~~
>> include/drm/drm_print.h:480:9: warning: initialization of 'struct device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     480 |         _Generic((drm),                                                 \
         |         ^~~~~~~~
   include/drm/drm_print.h:495:33: note: in expansion of macro '__drm_get_dev_ptr'
     495 |         struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
         |                                 ^~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:9: note: in expansion of macro '__drm_printk'
     513 |         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:89:17: note: in expansion of macro 'drm_err'
      89 |                 drm_err(commit->crtc->dev, "flip_done timed out\n");
         |                 ^~~~~~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_state_init':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:145:9: note: in expansion of macro 'drm_dbg_atomic'
     145 |         drm_dbg_atomic(dev, "Allocated atomic state %p\n", state);
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_state_default_clear':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:196:9: note: in expansion of macro 'drm_dbg_atomic'
     196 |         drm_dbg_atomic(dev, "Clearing atomic state %p\n", state);
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function '__drm_atomic_state_free':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:306:9: note: in expansion of macro 'drm_dbg_atomic'
     306 |         drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state);
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_get_crtc_state':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:363:9: note: in expansion of macro 'drm_dbg_atomic'
     363 |         drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n",
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_crtc_check':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:384:17: note: in expansion of macro 'drm_dbg_atomic'
     384 |                 drm_dbg_atomic(crtc->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:396:17: note: in expansion of macro 'drm_dbg_atomic'
     396 |                 drm_dbg_atomic(crtc->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:404:17: note: in expansion of macro 'drm_dbg_atomic'
     404 |                 drm_dbg_atomic(crtc->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:422:17: note: in expansion of macro 'drm_dbg_atomic'
     422 |                 drm_dbg_atomic(crtc->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_connector_check':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:469:17: note: in expansion of macro 'drm_dbg_atomic'
     469 |                 drm_dbg_atomic(connector->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:480:17: note: in expansion of macro 'drm_dbg_atomic'
     480 |                 drm_dbg_atomic(connector->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:489:25: note: in expansion of macro 'drm_dbg_atomic'
     489 |                         drm_dbg_atomic(connector->dev,
         |                         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_get_plane_state':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:549:9: note: in expansion of macro 'drm_dbg_atomic'
     549 |         drm_dbg_atomic(plane->dev, "Added [PLANE:%d:%s] %p state to %p\n",
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_plane_check':
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:606:17: note: in expansion of macro 'drm_dbg_atomic'
     606 |                 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] CRTC set but no FB\n",
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:610:17: note: in expansion of macro 'drm_dbg_atomic'
     610 |                 drm_dbg_atomic(plane->dev, "[PLANE:%d:%s] FB set but no CRTC\n",
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:621:17: note: in expansion of macro 'drm_dbg_atomic'
     621 |                 drm_dbg_atomic(plane->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:632:17: note: in expansion of macro 'drm_dbg_atomic'
     632 |                 drm_dbg_atomic(plane->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:644:17: note: in expansion of macro 'drm_dbg_atomic'
     644 |                 drm_dbg_atomic(plane->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
>> include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:660:17: note: in expansion of macro 'drm_dbg_atomic'
     660 |                 drm_dbg_atomic(plane->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:687:25: note: in expansion of macro 'drm_dbg_atomic'
     687 |                         drm_dbg_atomic(plane->dev,
         |                         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:698:17: note: in expansion of macro 'drm_dbg_atomic'
     698 |                 drm_dbg_atomic(plane->dev,
         |                 ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_get_private_obj_state':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:866:9: note: in expansion of macro 'drm_dbg_atomic'
     866 |         drm_dbg_atomic(state->dev,
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_get_connector_state':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:1048:9: note: in expansion of macro 'drm_dbg_atomic'
    1048 |         drm_dbg_atomic(connector->dev, "Added [CONNECTOR:%d:%s] %p state to %p\n",
         |         ^~~~~~~~~~~~~~
   include/drm/drm_print.h:360:63: note: expected 'const struct device *' but argument is of type 'int'
     360 | void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
         |                                          ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/gpu/drm/drm_atomic.c: In function 'drm_atomic_add_encoder_bridges':
   include/drm/drm_print.h:482:25: warning: passing argument 2 of '__drm_dev_dbg' makes pointer from integer without a cast [-Wint-conversion]
     482 |                         __drm_get_dev_ptr((drm), true),                 \
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                         |
         |                         int
   include/drm/drm_print.h:411:29: note: in definition of macro 'drm_dev_dbg'
     411 |         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
         |                             ^~~
   include/drm/drm_print.h:542:21: note: in expansion of macro '__drm_get_dev_ptr'
     542 |         drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
         |                     ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:1181:9: note: in expansion of macro 'drm_dbg_atomic'
    1181 |         drm_dbg_atomic(encoder->dev,
..


vim +480 include/drm/drm_print.h

   473	
   474	/**
   475	 * __drm_get_dev_ptr - Helper to get device pointer even if NULL is passed.
   476	 *		       Primarily for use in drm_*() print macros, since they
   477	 *		       need to handle NULL as the first argument passed.
   478	 */
   479	#define  __drm_get_dev_ptr(drm) \
 > 480		_Generic((drm),							\
   481			struct drm_device * :					\
 > 482				__drm_get_dev_ptr((drm), true),			\
   483			struct device * :					\
   484				__drm_get_dev_ptr((drm), false),		\
   485			default :						\
   486				NULL						\
   487		)
   488	
   489	/**
   490	 * Helper for struct drm_device based logging (prefer this over struct device).
   491	 * Also supports struct device ptr as an argument for edge cases.
   492	 */
   493	#define __drm_printk(drm, level, type, fmt, ...)			\
   494	({									\
 > 495		struct device *__dev_ = __drm_get_dev_ptr(drm);			\
   496		if (__dev_)							\
   497			dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__);	\
   498		else								\
   499			pr_##level##type("[drm] " fmt, ##__VA_ARGS__);		\
   500	})
   501	
   502	
   503	#define drm_info(drm, fmt, ...)					\
   504		__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
   505	
   506	#define drm_notice(drm, fmt, ...)				\
   507		__drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
   508	
   509	#define drm_warn(drm, fmt, ...)					\
   510		__drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
   511	
   512	#define drm_err(drm, fmt, ...)					\
   513		__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
   514	
   515	
   516	#define drm_info_once(drm, fmt, ...)				\
   517		__drm_printk((drm), info, _once, fmt, ##__VA_ARGS__)
   518	
   519	#define drm_notice_once(drm, fmt, ...)				\
   520		__drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__)
   521	
   522	#define drm_warn_once(drm, fmt, ...)				\
   523		__drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__)
   524	
   525	#define drm_err_once(drm, fmt, ...)				\
   526		__drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
   527	
   528	
   529	#define drm_err_ratelimited(drm, fmt, ...)				\
   530		__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
   531	
   532	
   533	#define drm_dbg_core(drm, fmt, ...)					\
   534		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_CORE, fmt, ##__VA_ARGS__)
   535	#define drm_dbg_driver(drm, fmt, ...)					\
 > 536		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
   537	#define drm_dbg_kms(drm, fmt, ...)					\
   538		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
   539	#define drm_dbg_prime(drm, fmt, ...)					\
   540		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_PRIME, fmt, ##__VA_ARGS__)
   541	#define drm_dbg_atomic(drm, fmt, ...)					\
   542		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
   543	#define drm_dbg_vbl(drm, fmt, ...)					\
   544		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_VBL, fmt, ##__VA_ARGS__)
   545	#define drm_dbg_state(drm, fmt, ...)					\
   546		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_STATE, fmt, ##__VA_ARGS__)
   547	#define drm_dbg_lease(drm, fmt, ...)					\
   548		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
   549	#define drm_dbg_dp(drm, fmt, ...)					\
   550		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
   551	#define drm_dbg_drmres(drm, fmt, ...)					\
   552		drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
   553
  
kernel test robot Jan. 6, 2023, 2:54 a.m. UTC | #3
Hi Siddh,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.2-rc2 next-20230105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/7acc7401b5ad0aec973948822bfa906a9615c43e.1672957022.git.code%40siddh.me
patch subject: [PATCH v4 01/10] drm/print: Fix and add support for NULL as first argument in drm_* macros
config: i386-randconfig-a002
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/8b796b03036f712417f8a87f85cdf9ac66d736ac
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Siddh-Raman-Pant/drm-print-Fix-and-add-support-for-NULL-as-first-argument-in-drm_-macros/20230106-062743
        git checkout 8b796b03036f712417f8a87f85cdf9ac66d736ac
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

>> drivers/gpu/drm/udl/udl_modeset.c:446:4: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           drm_err(dev, "Read EDID byte %zu failed err %x\n", i, ret);
                           ^
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/udl/udl_modeset.c:446:4: note: did you mean '___drm_get_dev_ptr'?
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   include/drm/drm_print.h:463:30: note: '___drm_get_dev_ptr' declared here
   static inline struct device *___drm_get_dev_ptr(const void *ptr, bool is_drm)
                                ^
>> drivers/gpu/drm/udl/udl_modeset.c:446:4: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                           drm_err(dev, "Read EDID byte %zu failed err %x\n", i, ret);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/udl/udl_modeset.c:450:4: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           drm_err(dev, "Read EDID byte %zu failed\n", i);
                           ^
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/udl/udl_modeset.c:450:4: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                           drm_err(dev, "Read EDID byte %zu failed\n", i);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   2 warnings and 2 errors generated.
--
>> drivers/gpu/drm/udl/udl_main.c:303:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_err(dev, "Timeout for syncing pending URBs\n");
                   ^
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/udl/udl_main.c:303:3: note: did you mean '___drm_get_dev_ptr'?
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   include/drm/drm_print.h:463:30: note: '___drm_get_dev_ptr' declared here
   static inline struct device *___drm_get_dev_ptr(const void *ptr, bool is_drm)
                                ^
>> drivers/gpu/drm/udl/udl_main.c:303:3: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                   drm_err(dev, "Timeout for syncing pending URBs\n");
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/udl/udl_main.c:316:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_warn(dev, "buffer sharing not supported"); /* not an error */
                   ^
   include/drm/drm_print.h:510:2: note: expanded from macro 'drm_warn'
           __drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/udl/udl_main.c:316:3: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                   drm_warn(dev, "buffer sharing not supported"); /* not an error */
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:510:2: note: expanded from macro 'drm_warn'
           __drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   2 warnings and 2 errors generated.
--
>> drivers/gpu/drm/drm_atomic.c:79:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_err(commit->crtc->dev, "hw_done timed out\n");
                   ^
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:79:3: note: did you mean '___drm_get_dev_ptr'?
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   include/drm/drm_print.h:463:30: note: '___drm_get_dev_ptr' declared here
   static inline struct device *___drm_get_dev_ptr(const void *ptr, bool is_drm)
                                ^
>> drivers/gpu/drm/drm_atomic.c:79:3: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                   drm_err(commit->crtc->dev, "hw_done timed out\n");
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:89:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_err(commit->crtc->dev, "flip_done timed out\n");
                   ^
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^
   include/drm/drm_print.h:495:26: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                                   ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:89:3: warning: incompatible integer to pointer conversion initializing 'struct device *' with an expression of type 'int' [-Wint-conversion]
                   drm_err(commit->crtc->dev, "flip_done timed out\n");
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:513:2: note: expanded from macro 'drm_err'
           __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:495:17: note: expanded from macro '__drm_printk'
           struct device *__dev_ = __drm_get_dev_ptr(drm);                 \
                          ^        ~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/drm_atomic.c:145:2: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           drm_dbg_atomic(dev, "Allocated atomic state %p\n", state);
           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
>> drivers/gpu/drm/drm_atomic.c:145:2: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
           drm_dbg_atomic(dev, "Allocated atomic state %p\n", state);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic.c:196:2: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           drm_dbg_atomic(dev, "Clearing atomic state %p\n", state);
           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:196:2: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
           drm_dbg_atomic(dev, "Clearing atomic state %p\n", state);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic.c:306:2: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state);
           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:306:2: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
           drm_dbg_atomic(state->dev, "Freeing atomic state %p\n", state);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic.c:363:2: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n",
           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:363:2: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
           drm_dbg_atomic(state->dev, "Added [CRTC:%d:%s] %p state to %p\n",
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic.c:384:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_dbg_atomic(crtc->dev,
                   ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic.c:384:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                   drm_dbg_atomic(crtc->dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
--
>> drivers/gpu/drm/drm_atomic_uapi.c:92:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_dbg_atomic(crtc->dev,
                   ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic_uapi.c:92:3: note: did you mean '___drm_get_dev_ptr'?
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   include/drm/drm_print.h:463:30: note: '___drm_get_dev_ptr' declared here
   static inline struct device *___drm_get_dev_ptr(const void *ptr, bool is_drm)
                                ^
>> drivers/gpu/drm/drm_atomic_uapi.c:92:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                   drm_dbg_atomic(crtc->dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic_uapi.c:98:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_dbg_atomic(crtc->dev,
                   ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic_uapi.c:98:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                   drm_dbg_atomic(crtc->dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic_uapi.c:137:4: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           drm_dbg_atomic(crtc->dev,
                           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic_uapi.c:137:4: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                           drm_dbg_atomic(crtc->dev,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic_uapi.c:147:4: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                           drm_dbg_atomic(crtc->dev,
                           ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic_uapi.c:147:4: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                           drm_dbg_atomic(crtc->dev,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:480:2: note: expanded from macro '__drm_get_dev_ptr'
           _Generic((drm),                                                 \
           ^
   include/drm/drm_print.h:411:22: note: expanded from macro 'drm_dev_dbg'
           __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
                               ^~~
   include/drm/drm_print.h:360:63: note: passing argument to parameter 'dev' here
   void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
                                                                 ^
   drivers/gpu/drm/drm_atomic_uapi.c:157:3: error: implicit declaration of function '__drm_get_dev_ptr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                   drm_dbg_atomic(crtc->dev,
                   ^
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
                       ^
   include/drm/drm_print.h:482:4: note: expanded from macro '__drm_get_dev_ptr'
                           __drm_get_dev_ptr((drm), true),                 \
                           ^
   drivers/gpu/drm/drm_atomic_uapi.c:157:3: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const struct device *' [-Wint-conversion]
                   drm_dbg_atomic(crtc->dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/drm/drm_print.h:542:14: note: expanded from macro 'drm_dbg_atomic'
           drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
..


vim +/__drm_get_dev_ptr +446 drivers/gpu/drm/udl/udl_modeset.c

0862cfd3e22f3f Thomas Zimmermann 2022-10-06  425  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  426  static int udl_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  427  {
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  428  	struct udl_device *udl = data;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  429  	struct drm_device *dev = &udl->drm;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  430  	struct usb_device *udev = udl_to_usb_device(udl);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  431  	u8 *read_buff;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  432  	int ret;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  433  	size_t i;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  434  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  435  	read_buff = kmalloc(2, GFP_KERNEL);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  436  	if (!read_buff)
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  437  		return -ENOMEM;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  438  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  439  	for (i = 0; i < len; i++) {
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  440  		int bval = (i + block * EDID_LENGTH) << 8;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  441  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  442  		ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  443  				      0x02, (0x80 | (0x02 << 5)), bval,
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  444  				      0xA1, read_buff, 2, USB_CTRL_GET_TIMEOUT);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  445  		if (ret < 0) {
0862cfd3e22f3f Thomas Zimmermann 2022-10-06 @446  			drm_err(dev, "Read EDID byte %zu failed err %x\n", i, ret);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  447  			goto err_kfree;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  448  		} else if (ret < 1) {
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  449  			ret = -EIO;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  450  			drm_err(dev, "Read EDID byte %zu failed\n", i);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  451  			goto err_kfree;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  452  		}
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  453  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  454  		buf[i] = read_buff[1];
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  455  	}
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  456  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  457  	kfree(read_buff);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  458  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  459  	return 0;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  460  
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  461  err_kfree:
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  462  	kfree(read_buff);
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  463  	return ret;
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  464  }
0862cfd3e22f3f Thomas Zimmermann 2022-10-06  465
  
Siddh Raman Pant Jan. 6, 2023, 7:32 a.m. UTC | #4
On Fri, 06 Jan 2023 06:43:35 +0530, kernel test robot wrote
> Hi Siddh,
> 
> Thank you for the patch! Perhaps something to improve:

Yes, I sent the rectification as a reply to this patch. [1]
Reviewers may please take note.

Thanks,
Siddh

[1] https://lore.kernel.org/all/20230105224018.132302-1-code@siddh.me/
  

Patch

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index a44fb7ef257f..df791cd747da 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -34,6 +34,7 @@ 
 #include <linux/dynamic_debug.h>
 
 #include <drm/drm.h>
+#include <drm/drm_device.h>
 
 /* Do *not* use outside of drm_print.[ch]! */
 extern unsigned long __drm_debug;
@@ -451,9 +452,52 @@  void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
  * Prefer drm_device based logging over device or prink based logging.
  */
 
-/* Helper for struct drm_device based logging. */
+/**
+ * ___drm_get_dev_ptr - Helper function to get device pointer.
+ * @ptr: struct drm_device pointer, struct device pointer, or NULL.
+ * @is_drm: True implies @ptr is drm_device pointer, else device pointer.
+ *
+ * RETURNS:
+ * The device pointer (NULL if @ptr is NULL).
+ */
+static inline struct device *___drm_get_dev_ptr(const void *ptr, bool is_drm)
+{
+	if (!ptr)
+		return NULL;
+
+	if (is_drm)
+		return ((struct drm_device *)ptr)->dev;
+
+	return (struct device *)ptr;
+}
+
+/**
+ * __drm_get_dev_ptr - Helper to get device pointer even if NULL is passed.
+ *		       Primarily for use in drm_*() print macros, since they
+ *		       need to handle NULL as the first argument passed.
+ */
+#define  __drm_get_dev_ptr(drm) \
+	_Generic((drm),							\
+		struct drm_device * :					\
+			__drm_get_dev_ptr((drm), true),			\
+		struct device * :					\
+			__drm_get_dev_ptr((drm), false),		\
+		default :						\
+			NULL						\
+	)
+
+/**
+ * Helper for struct drm_device based logging (prefer this over struct device).
+ * Also supports struct device ptr as an argument for edge cases.
+ */
 #define __drm_printk(drm, level, type, fmt, ...)			\
-	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
+({									\
+	struct device *__dev_ = __drm_get_dev_ptr(drm);			\
+	if (__dev_)							\
+		dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__);	\
+	else								\
+		pr_##level##type("[drm] " fmt, ##__VA_ARGS__);		\
+})
 
 
 #define drm_info(drm, fmt, ...)					\
@@ -487,25 +531,25 @@  void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
 
 
 #define drm_dbg_core(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-#define drm_dbg_driver(drm, fmt, ...)						\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_CORE, fmt, ##__VA_ARGS__)
+#define drm_dbg_driver(drm, fmt, ...)					\
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
 #define drm_dbg_kms(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
 #define drm_dbg_prime(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_PRIME, fmt, ##__VA_ARGS__)
 #define drm_dbg_atomic(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
 #define drm_dbg_vbl(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_VBL, fmt, ##__VA_ARGS__)
 #define drm_dbg_state(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_STATE, fmt, ##__VA_ARGS__)
 #define drm_dbg_lease(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
 #define drm_dbg_dp(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
 #define drm_dbg_drmres(drm, fmt, ...)					\
-	drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
+	drm_dev_dbg(__drm_get_dev_ptr(drm), DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
 
 #define drm_dbg(drm, fmt, ...)	drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
 
@@ -533,31 +577,31 @@  void __drm_err(const char *format, ...);
 #define _DRM_PRINTK(once, level, fmt, ...)				\
 	printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
 
-/* NOTE: this is deprecated in favor of pr_info(). */
+/* NOTE: this is deprecated in favor of drm_info(NULL, ...). */
 #define DRM_INFO(fmt, ...)						\
 	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_notice(). */
+/* NOTE: this is deprecated in favor of drm_notice(NULL, ...). */
 #define DRM_NOTE(fmt, ...)						\
 	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_warn(). */
+/* NOTE: this is deprecated in favor of drm_warn(NULL, ...). */
 #define DRM_WARN(fmt, ...)						\
 	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
 
-/* NOTE: this is deprecated in favor of pr_info_once(). */
+/* NOTE: this is deprecated in favor of drm_info_once(NULL, ...). */
 #define DRM_INFO_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_notice_once(). */
+/* NOTE: this is deprecated in favor of drm_notice_once(NULL, ...). */
 #define DRM_NOTE_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_warn_once(). */
+/* NOTE: this is deprecated in favor of drm_warn_once(NULL, ...). */
 #define DRM_WARN_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
 
-/* NOTE: this is deprecated in favor of pr_err(). */
+/* NOTE: this is deprecated in favor of drm_err(NULL, ...). */
 #define DRM_ERROR(fmt, ...)						\
 	__drm_err(fmt, ##__VA_ARGS__)
 
-/* NOTE: this is deprecated in favor of pr_err_ratelimited(). */
+/* NOTE: this is deprecated in favor of drm_err_ratelimited(NULL, ...). */
 #define DRM_ERROR_RATELIMITED(fmt, ...)					\
 	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
 
@@ -593,13 +637,14 @@  void __drm_err(const char *format, ...);
 #define DRM_DEBUG_DP(fmt, ...)						\
 	__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
 
-#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)					\
-({												\
-	static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
-	const struct drm_device *drm_ = (drm);							\
-												\
-	if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))			\
-		drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);	\
+#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)		\
+({									\
+	static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))\
+		drm_dev_printk(__drm_get_dev_ptr(drm), KERN_DEBUG,	\
+			       fmt, ## __VA_ARGS__);			\
 })
 
 #define drm_dbg_kms_ratelimited(drm, fmt, ...) \