You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
(151) |
Apr
(278) |
May
(221) |
Jun
(161) |
Jul
(158) |
Aug
(204) |
Sep
(111) |
Oct
(344) |
Nov
(246) |
Dec
(348) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(393) |
Feb
(317) |
Mar
(225) |
Apr
(338) |
May
(328) |
Jun
(226) |
Jul
(195) |
Aug
(191) |
Sep
(211) |
Oct
(212) |
Nov
(304) |
Dec
(280) |
2003 |
Jan
(332) |
Feb
(401) |
Mar
(355) |
Apr
(240) |
May
(277) |
Jun
(299) |
Jul
(97) |
Aug
(280) |
Sep
(300) |
Oct
(200) |
Nov
(272) |
Dec
(281) |
2004 |
Jan
(384) |
Feb
(155) |
Mar
(155) |
Apr
(98) |
May
(191) |
Jun
(117) |
Jul
(119) |
Aug
(242) |
Sep
(146) |
Oct
(166) |
Nov
(101) |
Dec
(133) |
2005 |
Jan
(196) |
Feb
(133) |
Mar
(190) |
Apr
(100) |
May
(124) |
Jun
(78) |
Jul
(73) |
Aug
(110) |
Sep
(87) |
Oct
(102) |
Nov
(67) |
Dec
(77) |
2006 |
Jan
(75) |
Feb
(35) |
Mar
(51) |
Apr
(144) |
May
(40) |
Jun
(70) |
Jul
(53) |
Aug
(34) |
Sep
(31) |
Oct
(49) |
Nov
(80) |
Dec
(53) |
2007 |
Jan
(72) |
Feb
(21) |
Mar
(67) |
Apr
(56) |
May
(45) |
Jun
(23) |
Jul
(15) |
Aug
(27) |
Sep
(41) |
Oct
(20) |
Nov
(60) |
Dec
(52) |
2008 |
Jan
(40) |
Feb
(53) |
Mar
(41) |
Apr
(12) |
May
(25) |
Jun
(20) |
Jul
(19) |
Aug
(23) |
Sep
(29) |
Oct
(15) |
Nov
(10) |
Dec
(18) |
2009 |
Jan
(24) |
Feb
(19) |
Mar
(5) |
Apr
(17) |
May
(11) |
Jun
(43) |
Jul
(4) |
Aug
(2) |
Sep
(17) |
Oct
(15) |
Nov
(15) |
Dec
(4) |
2010 |
Jan
(8) |
Feb
(5) |
Mar
(4) |
Apr
(23) |
May
(16) |
Jun
|
Jul
(5) |
Aug
(1) |
Sep
(7) |
Oct
(31) |
Nov
(11) |
Dec
(6) |
2011 |
Jan
(10) |
Feb
(3) |
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
(5) |
Aug
(1) |
Sep
(25) |
Oct
(1) |
Nov
(13) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(9) |
Dec
(3) |
2013 |
Jan
(3) |
Feb
(1) |
Mar
(9) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
(2) |
Sep
|
Oct
(2) |
Nov
(4) |
Dec
(5) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(6) |
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(3) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(10) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(2) |
Mar
|
Apr
(7) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(7) |
Oct
(5) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(12) |
Nov
|
Dec
|
2021 |
Jan
(9) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(45) |
Jun
(1) |
Jul
|
Aug
|
Sep
(23) |
Oct
(39) |
Nov
(8) |
Dec
(19) |
2022 |
Jan
|
Feb
|
Mar
(10) |
Apr
(26) |
May
(8) |
Jun
(2) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(21) |
Nov
(3) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2024 |
Jan
(14) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Philipp H. <phi...@gm...> - 2022-07-22 18:52:41
|
On 7/22/22 20:26, Abhijeet Srivastava wrote: > Deleted part of code in block comment > > Signed-off-by: Abhijeet Srivastava <abh...@gm...> > --- > drivers/staging/media/zoran/zoran_driver.c | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c > index b408c1d4e0a7..836edf623571 100644 > --- a/drivers/staging/media/zoran/zoran_driver.c > +++ b/drivers/staging/media/zoran/zoran_driver.c > @@ -746,11 +746,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { > .vidioc_enum_input = zoran_enum_input, > .vidioc_g_input = zoran_g_input, > .vidioc_s_input = zoran_s_input, > - > -/* .vidioc_enum_output = zoran_enum_output, > - * .vidioc_g_output = zoran_g_output, > - * .vidioc_s_output = zoran_s_output, > - */ > .vidioc_g_std = zoran_g_std, > .vidioc_s_std = zoran_s_std, > .vidioc_create_bufs = vb2_ioctl_create_bufs, > @@ -762,13 +757,9 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { > .vidioc_streamon = vb2_ioctl_streamon, > .vidioc_streamoff = vb2_ioctl_streamoff, > .vidioc_enum_fmt_vid_cap = zoran_enum_fmt_vid_cap, > -/* .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out,*/ > .vidioc_g_fmt_vid_cap = zoran_g_fmt_vid_cap, > -/* .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out,*/ > .vidioc_s_fmt_vid_cap = zoran_s_fmt_vid_cap, > -/* .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out,*/ > .vidioc_try_fmt_vid_cap = zoran_try_fmt_vid_cap, > -/* .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out,*/ > .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, > .vidioc_unsubscribe_event = v4l2_event_unsubscribe, > }; Why does the subject line start with "media:" The subsystem is "staging:" so the subject should start with "staging: media: ..." I have no clue if this is accepted. Regards, Philipp |
From: Abhijeet S. <abh...@gm...> - 2022-07-22 18:26:38
|
Deleted part of code in block comment Signed-off-by: Abhijeet Srivastava <abh...@gm...> --- drivers/staging/media/zoran/zoran_driver.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index b408c1d4e0a7..836edf623571 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -746,11 +746,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_enum_input = zoran_enum_input, .vidioc_g_input = zoran_g_input, .vidioc_s_input = zoran_s_input, - -/* .vidioc_enum_output = zoran_enum_output, - * .vidioc_g_output = zoran_g_output, - * .vidioc_s_output = zoran_s_output, - */ .vidioc_g_std = zoran_g_std, .vidioc_s_std = zoran_s_std, .vidioc_create_bufs = vb2_ioctl_create_bufs, @@ -762,13 +757,9 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_streamon = vb2_ioctl_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_enum_fmt_vid_cap = zoran_enum_fmt_vid_cap, -/* .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out,*/ .vidioc_g_fmt_vid_cap = zoran_g_fmt_vid_cap, -/* .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out,*/ .vidioc_s_fmt_vid_cap = zoran_s_fmt_vid_cap, -/* .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out,*/ .vidioc_try_fmt_vid_cap = zoran_try_fmt_vid_cap, -/* .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out,*/ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, }; -- 2.34.1 |
From: Dan C. <dan...@or...> - 2022-07-22 06:33:23
|
On Thu, Jul 21, 2022 at 11:07:22PM +0530, Abhijeet Srivastava wrote: > Warning found by checkpatch.pl script. > > Signed-off-by: Abhijeet Srivastava <abh...@gm...> > --- > drivers/staging/media/zoran/zoran_driver.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c > index 4304b7e21709..b408c1d4e0a7 100644 > --- a/drivers/staging/media/zoran/zoran_driver.c > +++ b/drivers/staging/media/zoran/zoran_driver.c > @@ -746,9 +746,11 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { > .vidioc_enum_input = zoran_enum_input, > .vidioc_g_input = zoran_g_input, > .vidioc_s_input = zoran_s_input, > + > /* .vidioc_enum_output = zoran_enum_output, > - .vidioc_g_output = zoran_g_output, > - .vidioc_s_output = zoran_s_output,*/ > + * .vidioc_g_output = zoran_g_output, > + * .vidioc_s_output = zoran_s_output, > + */ Always, just delete dead code. regards, dan carpenter |
From: Philipp H. <phi...@gm...> - 2022-07-22 04:55:01
|
On 7/21/22 17:00, Abhijeet Srivastava wrote: > Warning found by checkpatch.pl script. > > Signed-off-by: Abhijeet Srivastava <abh...@gm...> > --- > drivers/staging/media/zoran/zoran_card.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c > index 26f978a1cc72..0c138d47d0c3 100644 > --- a/drivers/staging/media/zoran/zoran_card.c > +++ b/drivers/staging/media/zoran/zoran_card.c > @@ -1038,9 +1038,9 @@ static int zr36057_init(struct zoran *zr) > zr->stat_com = dma_alloc_coherent(&zr->pci_dev->dev, > BUZ_NUM_STAT_COM * sizeof(u32), > &zr->p_sc, GFP_KERNEL); > - if (!zr->stat_com) { > + if (!zr->stat_com) > return -ENOMEM; > - } > + > for (j = 0; j < BUZ_NUM_STAT_COM; j++) > zr->stat_com[j] = cpu_to_le32(1); /* mark as unavailable to zr36057 */ > Why does the subject line start with "media:" The subsystem is "staging:" so the subject should start with "staging: media: ..." I have no clue if this is accepted. Regards, Philipp |
From: Abhijeet S. <abh...@gm...> - 2022-07-21 17:37:46
|
Warning found by checkpatch.pl script. Signed-off-by: Abhijeet Srivastava <abh...@gm...> --- drivers/staging/media/zoran/zoran_driver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 4304b7e21709..b408c1d4e0a7 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -746,9 +746,11 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_enum_input = zoran_enum_input, .vidioc_g_input = zoran_g_input, .vidioc_s_input = zoran_s_input, + /* .vidioc_enum_output = zoran_enum_output, - .vidioc_g_output = zoran_g_output, - .vidioc_s_output = zoran_s_output,*/ + * .vidioc_g_output = zoran_g_output, + * .vidioc_s_output = zoran_s_output, + */ .vidioc_g_std = zoran_g_std, .vidioc_s_std = zoran_s_std, .vidioc_create_bufs = vb2_ioctl_create_bufs, -- 2.34.1 |
From: Abhijeet S. <abh...@gm...> - 2022-07-21 15:38:07
|
Warning found by checkpatch.pl script Signed-off-by: Abhijeet Srivastava <abh...@gm...> --- drivers/staging/media/zoran/videocodec.h | 180 +++++++++++------------ 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 9dea348fee40..58365b0932b4 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -13,108 +13,108 @@ /* =================== */ /* Should ease the (re-)usage of drivers supporting cards with (different) - video codecs. The codecs register to this module their functionality, - and the processors (masters) can attach to them if they fit. - - The codecs are typically have a "strong" binding to their master - so I - don't think it makes sense to have a full blown interfacing as with e.g. - i2c. If you have an other opinion, let's discuss & implement it :-))) - - Usage: - - The slave has just to setup the videocodec structure and use two functions: - videocodec_register(codecdata); - videocodec_unregister(codecdata); - The best is just calling them at module (de-)initialisation. - - The master sets up the structure videocodec_master and calls: - codecdata=videocodec_attach(master_codecdata); - videocodec_detach(codecdata); - - The slave is called during attach/detach via functions setup previously - during register. At that time, the master_data pointer is set up - and the slave can access any io registers of the master device (in the case - the slave is bound to it). Otherwise it doesn't need this functions and - therfor they may not be initialized. - - The other functions are just for convenience, as they are for sure used by - most/all of the codecs. The last ones may be omitted, too. - - See the structure declaration below for more information and which data has - to be set up for the master and the slave. - - ---------------------------------------------------------------------------- - The master should have "knowledge" of the slave and vice versa. So the data - structures sent to/from slave via set_data/get_data set_image/get_image are - device dependent and vary between MJPEG/MPEG/WAVELET/... devices. (!!!!) - ---------------------------------------------------------------------------- -*/ + * video codecs. The codecs register to this module their functionality, + * and the processors (masters) can attach to them if they fit. + * + * The codecs are typically have a "strong" binding to their master - so I + * don't think it makes sense to have a full blown interfacing as with e.g. + * i2c. If you have an other opinion, let's discuss & implement it :-))) + * + * Usage: + * + * The slave has just to setup the videocodec structure and use two functions: + * videocodec_register(codecdata); + * videocodec_unregister(codecdata); + * The best is just calling them at module (de-)initialisation. + * + * The master sets up the structure videocodec_master and calls: + * codecdata=videocodec_attach(master_codecdata); + * videocodec_detach(codecdata); + * + * The slave is called during attach/detach via functions setup previously + * during register. At that time, the master_data pointer is set up + * and the slave can access any io registers of the master device (in the case + * the slave is bound to it). Otherwise it doesn't need this functions and + * therfor they may not be initialized. + * + * The other functions are just for convenience, as they are for sure used by + * most/all of the codecs. The last ones may be omitted, too. + * + * See the structure declaration below for more information and which data has + * to be set up for the master and the slave. + * + * ---------------------------------------------------------------------------- + * The master should have "knowledge" of the slave and vice versa. So the data + * structures sent to/from slave via set_data/get_data set_image/get_image are + * device dependent and vary between MJPEG/MPEG/WAVELET/... devices. (!!!!) + * ---------------------------------------------------------------------------- + */ /* ========================================== */ /* description of the videocodec_io structure */ /* ========================================== */ /* - ==== master setup ==== - name -> name of the device structure for reference and debugging - master_data -> data ref. for the master (e.g. the zr36055,57,67) - readreg -> ref. to read-fn from register (setup by master, used by slave) - writereg -> ref. to write-fn to register (setup by master, used by slave) - this two functions do the lowlevel I/O job - - ==== slave functionality setup ==== - slave_data -> data ref. for the slave (e.g. the zr36050,60) - check -> fn-ref. checks availability of an device, returns -EIO on failure or - the type on success - this makes espcecially sense if a driver module supports more than - one codec which may be quite similar to access, nevertheless it - is good for a first functionality check - - -- main functions you always need for compression/decompression -- - - set_mode -> this fn-ref. resets the entire codec, and sets up the mode - with the last defined norm/size (or device default if not - available) - it returns 0 if the mode is possible - set_size -> this fn-ref. sets the norm and image size for - compression/decompression (returns 0 on success) - the norm param is defined in videodev2.h (V4L2_STD_*) - - additional setup may be available, too - but the codec should work with - some default values even without this - - set_data -> sets device-specific data (tables, quality etc.) - get_data -> query device-specific data (tables, quality etc.) - - if the device delivers interrupts, they may be setup/handled here - setup_interrupt -> codec irq setup (not needed for 36050/60) - handle_interrupt -> codec irq handling (not needed for 36050/60) - - if the device delivers pictures, they may be handled here - put_image -> puts image data to the codec (not needed for 36050/60) - get_image -> gets image data from the codec (not needed for 36050/60) - the calls include frame numbers and flags (even/odd/...) - if needed and a flag which allows blocking until its ready -*/ + * ==== master setup ==== + * name -> name of the device structure for reference and debugging + * master_data -> data ref. for the master (e.g. the zr36055,57,67) + * readreg -> ref. to read-fn from register (setup by master, used by slave) + * writereg -> ref. to write-fn to register (setup by master, used by slave) + * this two functions do the lowlevel I/O job + * + * ==== slave functionality setup ==== + * slave_data -> data ref. for the slave (e.g. the zr36050,60) + * check -> fn-ref. checks availability of an device, returns -EIO on failure or + * the type on success + * this makes espcecially sense if a driver module supports more than + * one codec which may be quite similar to access, nevertheless it + * is good for a first functionality check + * + * -- main functions you always need for compression/decompression -- + * + * set_mode -> this fn-ref. resets the entire codec, and sets up the mode + * with the last defined norm/size (or device default if not + * available) - it returns 0 if the mode is possible + * + * set_size -> this fn-ref. sets the norm and image size for + * compression/decompression (returns 0 on success) + * the norm param is defined in videodev2.h (V4L2_STD_*) + * additional setup may be available, too - but the codec should work with + * some default values even without this + * + * set_data -> sets device-specific data (tables, quality etc.) + * get_data -> query device-specific data (tables, quality etc.) + * + * if the device delivers interrupts, they may be setup/handled here + * setup_interrupt -> codec irq setup (not needed for 36050/60) + * handle_interrupt -> codec irq handling (not needed for 36050/60) + * + * if the device delivers pictures, they may be handled here + * put_image -> puts image data to the codec (not needed for 36050/60) + * + * get_image -> gets image data from the codec (not needed for 36050/60) + * the calls include frame numbers and flags (even/odd/...) + * if needed and a flag which allows blocking until its ready + */ /* ============== */ /* user interface */ /* ============== */ /* - Currently there is only a information display planned, as the layer - is not visible for the user space at all. - - Information is available via procfs. The current entry is "/proc/videocodecs" - but it makes sense to "hide" it in the /proc/video tree of v4l(2) --TODO--. - -A example for such an output is: - -<S>lave or attached <M>aster name type flags magic (connected as) -S zr36050 0002 0000d001 00000000 (TEMPLATE) -M zr36055[0] 0001 0000c001 00000000 (zr36050[0]) -M zr36055[1] 0001 0000c001 00000000 (zr36050[1]) - -*/ + * Currently there is only a information display planned, as the layer + * is not visible for the user space at all. + * + * Information is available via procfs. The current entry is "/proc/videocodecs" + * but it makes sense to "hide" it in the /proc/video tree of v4l(2) --TODO--. + * + * A example for such an output is: + * + * <S>lave or attached <M>aster name type flags magic (connected as) + * S zr36050 0002 0000d001 00000000 (TEMPLATE) + * M zr36055[0] 0001 0000c001 00000000 (zr36050[0]) + * M zr36055[1] 0001 0000c001 00000000 (zr36050[1]) + */ /* =============================================== */ /* special defines for the videocodec_io structure */ -- 2.34.1 |
From: Abhijeet S. <abh...@gm...> - 2022-07-21 15:01:17
|
Warning found by checkpatch.pl script. Signed-off-by: Abhijeet Srivastava <abh...@gm...> --- drivers/staging/media/zoran/zoran_card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 26f978a1cc72..0c138d47d0c3 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1038,9 +1038,9 @@ static int zr36057_init(struct zoran *zr) zr->stat_com = dma_alloc_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), &zr->p_sc, GFP_KERNEL); - if (!zr->stat_com) { + if (!zr->stat_com) return -ENOMEM; - } + for (j = 0; j < BUZ_NUM_STAT_COM; j++) zr->stat_com[j] = cpu_to_le32(1); /* mark as unavailable to zr36057 */ -- 2.34.1 |
From: Bernhard P. <sha...@ut...> - 2022-07-05 17:31:23
|
Hallo, I don't know who did change the the setting, but the last 2 weeks a few mails with the subject BUILD REGRESSION were sent from the lk...@in... to the mjpeg-users mailinglist. There is currently another with the subject: [linux-next:master] BUILD REGRESSION, waiting for a decision. It is Ok for me that some robot sends a mail to the list. But the proper list would be the mjpeg-developer list. I did check if it is possible to change the E-Mail destination. But I did not find the proper hint. So does anybody know where I can request that they change the destination ? Regards, Bernhard |
From: Roman G. <rom...@li...> - 2022-07-02 01:20:29
|
esOn Fri, Jul 01, 2022 at 07:49:42AM +0800, kbuild test robot wrote: > tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > branch HEAD: 6cc11d2a1759275b856e464265823d94aabd5eaf Add linux-next specific files for 20220630 > > Error/Warning reports: > > https://lore.kernel.org/linux-mm/202...@in... > > Error/Warning: (recently discovered and may have been fixed) > > arch/powerpc/kernel/interrupt.c:542:55: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] > arch/powerpc/kernel/interrupt.c:542:55: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] > drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: no previous prototype for 'pci_read' [-Wmissing-prototypes] > drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: no previous prototype for 'pci_write' [-Wmissing-prototypes] > mm/shrinker_debug.c:143:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > mm/shrinker_debug.c:217:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > mm/vmscan.c:637:9: warning: function 'prealloc_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > mm/vmscan.c:642:9: warning: function 'prealloc_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > mm/vmscan.c:697:9: warning: function 'register_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] > mm/vmscan.c:702:9: warning: function 'register_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] Shrinker-related warnings should be fixed by the following patch. Thanks! -- >From c399aff65c7745a209397a531c5b28fd404d83c2 Mon Sep 17 00:00:00 2001 From: Roman Gushchin <rom...@li...v> Date: Fri, 1 Jul 2022 17:38:31 -0700 Subject: [PATCH] mm:shrinkers: fix build warnings Add __printf(a, b) attributes to shrinker functions taking shrinker name as an argument to avoid compiler warnings like: mm/shrinker_debug.c:143:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] mm/shrinker_debug.c:217:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] mm/vmscan.c:637:9: warning: function 'prealloc_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] mm/vmscan.c:642:9: warning: function 'prealloc_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] mm/vmscan.c:697:9: warning: function 'register_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] mm/vmscan.c:702:9: warning: function 'register_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] Signed-off-by: Roman Gushchin <rom...@li...v> --- include/linux/shrinker.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 64416f3e0a1f..08e6054e061f 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -93,9 +93,11 @@ struct shrinker { */ #define SHRINKER_NONSLAB (1 << 3) -extern int prealloc_shrinker(struct shrinker *shrinker, const char *fmt, ...); +extern int __printf(2, 3) prealloc_shrinker(struct shrinker *shrinker, + const char *fmt, ...); extern void register_shrinker_prepared(struct shrinker *shrinker); -extern int register_shrinker(struct shrinker *shrinker, const char *fmt, ...); +extern int __printf(2, 3) register_shrinker(struct shrinker *shrinker, + const char *fmt, ...); extern void unregister_shrinker(struct shrinker *shrinker); extern void free_prealloced_shrinker(struct shrinker *shrinker); extern void synchronize_shrinkers(void); @@ -103,8 +105,8 @@ extern void synchronize_shrinkers(void); #ifdef CONFIG_SHRINKER_DEBUG extern int shrinker_debugfs_add(struct shrinker *shrinker); extern void shrinker_debugfs_remove(struct shrinker *shrinker); -extern int shrinker_debugfs_rename(struct shrinker *shrinker, - const char *fmt, ...); +extern int __printf(2, 3) shrinker_debugfs_rename(struct shrinker *shrinker, + const char *fmt, ...); #else /* CONFIG_SHRINKER_DEBUG */ static inline int shrinker_debugfs_add(struct shrinker *shrinker) { @@ -113,8 +115,8 @@ static inline int shrinker_debugfs_add(struct shrinker *shrinker) static inline void shrinker_debugfs_remove(struct shrinker *shrinker) { } -static inline int shrinker_debugfs_rename(struct shrinker *shrinker, - const char *fmt, ...) +static inline __printf(2, 3) +int shrinker_debugfs_rename(struct shrinker *shrinker, const char *fmt, ...) { return 0; } -- 2.36.1 |
From: kernel t. r. <lk...@in...> - 2022-06-29 19:59:16
|
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: c4ef528bd006febc7de444d9775b28706d924f78 Add linux-next specific files for 20220629 Error/Warning reports: https://lore.kernel.org/linux-mm/202...@in... Error/Warning: (recently discovered and may have been fixed) arch/powerpc/kernel/interrupt.c:542:55: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] arch/powerpc/kernel/interrupt.c:542:55: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:1025:33: warning: variable 'pre_connection_type' set but not used [-Wunused-but-set-variable] drivers/pci/endpoint/functions/pci-epf-vntb.c:1247: undefined reference to `ntb_register_device' drivers/pci/endpoint/functions/pci-epf-vntb.c:174: undefined reference to `ntb_link_event' drivers/pci/endpoint/functions/pci-epf-vntb.c:262: undefined reference to `ntb_db_event' drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: no previous prototype for 'pci_read' [-Wmissing-prototypes] drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: no previous prototype for 'pci_write' [-Wmissing-prototypes] Unverified Error/Warning (likely false positive, please contact us if interested): drivers/net/ethernet/microchip/lan743x_main.c:1238:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/soc/mediatek/mtk-mutex.c:799:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36016.c:430:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36050.c:829:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36060.c:869:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/thunderbolt/tmu.c:758:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 sound/soc/sof/intel/mtl.c:547:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 Error/Warning ids grouped by kconfigs: gcc_recent_errors |-- alpha-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- alpha-randconfig-r013-20220629 | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arc-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-net-ethernet-microchip-lan743x_main.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write | |-- drivers-soc-mediatek-mtk-mutex.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36016.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36050.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36060.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-thunderbolt-tmu.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | `-- sound-soc-sof-intel-mtl.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c |-- arc-randconfig-r043-20220629 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- arm-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arm64-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arm64-randconfig-r012-20220629 | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:undefined-reference-to-ntb_db_event | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:undefined-reference-to-ntb_link_event | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:undefined-reference-to-ntb_register_device | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- i386-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- i386-randconfig-m021 | `-- arch-x86-events-core.c-init_hw_perf_events()-warn:missing-error-code-err |-- i386-randconfig-s002-20220627 | |-- fs-ntfs3-attrib.c:sparse:sparse:cast-to-restricted-__le64 | |-- fs-ntfs3-attrib.c:sparse:sparse:incorrect-type-in-assignment-(different-base-types)-expected-restricted-__le64-usertype-alloc_size-got-unsigned-long-long-usertype | |-- fs-ntfs3-attrib.c:sparse:sparse:incorrect-type-in-assignment-(different-base-types)-expected-restricted-__le64-usertype-data_size-got-unsigned-long-long-usertype | `-- fs-ntfs3-attrib.c:sparse:sparse:restricted-__le16-degrades-to-integer |-- ia64-allmodconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- microblaze-randconfig-r032-20220629 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- microblaze-randconfig-r033-20220629 | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- mips-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- parisc-randconfig-r034-20220629 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- powerpc-allmodconfig | |-- arch-powerpc-kernel-interrupt.c:warning:suggest-braces-around-empty-body-in-an-if-statement | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- powerpc-allnoconfig | `-- arch-powerpc-kernel-interrupt.c:error:suggest-braces-around-empty-body-in-an-if-statement |-- sparc-randconfig-r011-20220629 | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- x86_64-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write `-- x86_64-randconfig-m001 `-- arch-x86-events-core.c-init_hw_perf_events()-warn:missing-error-code-err elapsed time: 723m configs tested: 52 configs skipped: 2 gcc tested configs: arm defconfig arm64 allyesconfig arm allyesconfig ia64 allmodconfig powerpc allnoconfig mips allyesconfig powerpc allmodconfig sh allmodconfig alpha allyesconfig m68k allmodconfig arc allyesconfig m68k allyesconfig i386 defconfig i386 allyesconfig i386 randconfig-a001 i386 randconfig-a003 i386 randconfig-a005 x86_64 randconfig-a013 x86_64 randconfig-a011 x86_64 randconfig-a015 i386 randconfig-a014 i386 randconfig-a012 i386 randconfig-a016 x86_64 randconfig-a004 x86_64 randconfig-a002 x86_64 randconfig-a006 arc randconfig-r043-20220629 s390 randconfig-r044-20220629 riscv randconfig-r042-20220629 um i386_defconfig um x86_64_defconfig x86_64 rhel-8.3-kunit x86_64 rhel-8.3-syz x86_64 rhel-8.3-func x86_64 rhel-8.3-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 allyesconfig clang tested configs: i386 randconfig-a002 i386 randconfig-a006 i386 randconfig-a004 x86_64 randconfig-a014 x86_64 randconfig-a016 x86_64 randconfig-a012 i386 randconfig-a013 i386 randconfig-a015 i386 randconfig-a011 x86_64 randconfig-a005 x86_64 randconfig-a001 x86_64 randconfig-a003 hexagon randconfig-r045-20220629 hexagon randconfig-r041-20220629 -- 0-DAY CI Kernel Test Service https://01.org/lkp |
From: kernel t. r. <lk...@in...> - 2022-06-27 19:41:00
|
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: aab35c3d5112df6e329a1a5a5a1881e5c4ca3821 Add linux-next specific files for 20220627 Error/Warning: (recently discovered and may have been fixed) arch/powerpc/kernel/interrupt.c:542:55: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] arch/powerpc/kernel/interrupt.c:542:55: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:1025:33: warning: variable 'pre_connection_type' set but not used [-Wunused-but-set-variable] drivers/ntb/test/ntb_perf.c:1145: undefined reference to `__umoddi3' drivers/pci/endpoint/functions/pci-epf-vntb.c:975:5: warning: no previous prototype for 'pci_read' [-Wmissing-prototypes] drivers/pci/endpoint/functions/pci-epf-vntb.c:984:5: warning: no previous prototype for 'pci_write' [-Wmissing-prototypes] vmlinux.o: warning: objtool: __ct_user_enter+0x8c: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_idle_enter+0x19: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_idle_exit+0x3e: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_irq_enter+0x6a: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_irq_exit+0x6a: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_kernel_enter.constprop.0+0x2a: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_kernel_enter_state+0x2d: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_kernel_exit.constprop.0+0x53: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_kernel_exit_state+0x2d: call to ftrace_likely_update() leaves .noinstr.text section vmlinux.o: warning: objtool: ct_nmi_enter+0x4b: call to ftrace_likely_update() leaves .noinstr.text section Unverified Error/Warning (likely false positive, please contact us if interested): drivers/acpi/scan.c:615:35: warning: Uninitialized variable: acpi_device_bus_id->bus_id [uninitvar] drivers/phy/qualcomm/phy-qcom-qmp-combo.c:1701:19: warning: Value stored to 'qmp' during its initialization is never read [clang-analyzer-deadcode.DeadStores] drivers/soc/mediatek/mtk-mutex.c:799:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36016.c:430:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36050.c:829:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/staging/media/zoran/zr36060.c:869:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 drivers/thunderbolt/tmu.c:758:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 sound/soc/sof/intel/mtl.c:547:1: internal compiler error: in arc_ifcvt, at config/arc/arc.c:9637 Error/Warning ids grouped by kconfigs: gcc_recent_errors |-- alpha-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arc-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write | |-- drivers-soc-mediatek-mtk-mutex.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36016.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36050.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-staging-media-zoran-zr36060.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | |-- drivers-thunderbolt-tmu.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c | `-- sound-soc-sof-intel-mtl.c:internal-compiler-error:in-arc_ifcvt-at-config-arc-arc.c |-- arm-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- arm64-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- i386-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write | `-- ntb_perf.c:(.text):undefined-reference-to-__umoddi3 |-- i386-randconfig-a013-20220627 | `-- ERROR:__umoddi3-drivers-ntb-test-ntb_perf.ko-undefined |-- i386-randconfig-m021-20220627 | `-- arch-x86-events-core.c-init_hw_perf_events()-warn:missing-error-code-err |-- i386-randconfig-p001-20220627 | `-- drivers-acpi-scan.c:warning:Uninitialized-variable:acpi_device_bus_id-bus_id-uninitvar |-- ia64-allmodconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- mips-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- powerpc-allmodconfig | |-- ERROR:__umoddi3-drivers-ntb-test-ntb_perf.ko-undefined | |-- arch-powerpc-kernel-interrupt.c:warning:suggest-braces-around-empty-body-in-an-if-statement | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- powerpc-allnoconfig | `-- arch-powerpc-kernel-interrupt.c:error:suggest-braces-around-empty-body-in-an-if-statement |-- powerpc-buildonly-randconfig-r003-20220627 | `-- arch-powerpc-kernel-interrupt.c:error:suggest-braces-around-empty-body-in-an-if-statement |-- powerpc-buildonly-randconfig-r005-20220627 | |-- arch-powerpc-kernel-interrupt.c:warning:suggest-braces-around-empty-body-in-an-if-statement | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- powerpc-randconfig-r023-20220627 | `-- arch-powerpc-kernel-interrupt.c:warning:suggest-braces-around-empty-body-in-an-if-statement |-- riscv-randconfig-r012-20220627 | |-- ERROR:__umoddi3-drivers-ntb-test-ntb_perf.ko-undefined | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- s390-buildonly-randconfig-r001-20220627 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- sparc-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- sparc-randconfig-r032-20220627 | `-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used |-- x86_64-allyesconfig | |-- drivers-gpu-drm-amd-amdgpu-..-display-dc-core-dc_link.c:warning:variable-pre_connection_type-set-but-not-used | |-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_read | `-- drivers-pci-endpoint-functions-pci-epf-vntb.c:warning:no-previous-prototype-for-pci_write |-- x86_64-randconfig-a011-20220627 | |-- vmlinux.o:warning:objtool:__ct_user_enter:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_idle_enter:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_idle_exit:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_irq_enter:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_irq_exit:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_kernel_enter:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_kernel_enter_state:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_kernel_exit:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | |-- vmlinux.o:warning:objtool:ct_kernel_exit_state:call-to-ftrace_likely_update()-leaves-.noinstr.text-section | `-- vmlinux.o:warning:objtool:ct_nmi_enter:call-to-ftrace_likely_update()-leaves-.noinstr.text-section |-- x86_64-randconfig-m001-20220627 | `-- arch-x86-events-core.c-init_hw_perf_events()-warn:missing-error-code-err `-- xtensa-randconfig-r024-20220627 `-- drivers-ntb-test-ntb_perf.c:undefined-reference-to-__umoddi3 clang_recent_errors `-- riscv-randconfig-c006-20220617 `-- drivers-phy-qualcomm-phy-qcom-qmp-combo.c:warning:Value-stored-to-qmp-during-its-initialization-is-never-read-clang-analyzer-deadcode.DeadStores elapsed time: 726m configs tested: 52 configs skipped: 2 gcc tested configs: arm defconfig arm allyesconfig arm64 allyesconfig ia64 allmodconfig alpha allyesconfig m68k allmodconfig arc allyesconfig m68k allyesconfig powerpc allnoconfig sh allmodconfig powerpc allmodconfig mips allyesconfig i386 defconfig i386 allyesconfig x86_64 randconfig-a012-20220627 x86_64 randconfig-a011-20220627 x86_64 randconfig-a013-20220627 x86_64 randconfig-a014-20220627 x86_64 randconfig-a015-20220627 x86_64 randconfig-a016-20220627 i386 randconfig-a012-20220627 i386 randconfig-a011-20220627 i386 randconfig-a013-20220627 i386 randconfig-a014-20220627 i386 randconfig-a015-20220627 i386 randconfig-a016-20220627 arc randconfig-r043-20220627 s390 randconfig-r044-20220627 riscv randconfig-r042-20220627 um i386_defconfig um x86_64_defconfig x86_64 rhel-8.3-kunit x86_64 rhel-8.3-syz x86_64 rhel-8.3-func x86_64 rhel-8.3-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 allyesconfig clang tested configs: i386 randconfig-a001-20220627 i386 randconfig-a002-20220627 i386 randconfig-a003-20220627 i386 randconfig-a006-20220627 i386 randconfig-a005-20220627 i386 randconfig-a004-20220627 x86_64 randconfig-a002-20220627 x86_64 randconfig-a003-20220627 x86_64 randconfig-a001-20220627 x86_64 randconfig-a006-20220627 x86_64 randconfig-a005-20220627 x86_64 randconfig-a004-20220627 hexagon randconfig-r041-20220627 hexagon randconfig-r045-20220627 -- 0-DAY CI Kernel Test Service https://01.org/lkp |
From: Ian C. <ia...@li...> - 2022-05-06 20:50:16
|
On Fri, May 06, 2022 at 10:14:55AM +0300, Dan Carpenter wrote: > On Fri, May 06, 2022 at 01:30:12AM -0400, Ian Cowan wrote: > > On Thu, Apr 28, 2022 at 10:15:03AM +0200, Hans Verkuil wrote: > > > Hi Ian, > > > > > > When I compiled this patch series with smatch I got these warnings: > > > > > > zoran/videocodec.c:45 videocodec_attach() warn: variable dereferenced before check 'master' (see line 40) > > > zoran/videocodec.c:115 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 111) > > > zoran/videocodec.c:168 videocodec_register() warn: variable dereferenced before check 'codec' (see line 166) > > > zoran/videocodec.c:200 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 198) > > > > > > And I also got this warning when checking the kerneldoc: > > > > > > zoran/zoran.h:307: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst > > > > > What did you use to see these issues? When I ran the checkpatch script > > and compiled, I did not see any of this. > > > > I have written a blog entry about checking kernel code with Smatch: > > https://staticthinking.wordpress.com/2022/04/25/how-to-run-smatch-on-your-code/ > > regards, > dan carpenter > Fantastic, I'll give that a read. Thanks! Ian |
From: Dan C. <dan...@or...> - 2022-05-06 07:15:42
|
On Fri, May 06, 2022 at 01:30:12AM -0400, Ian Cowan wrote: > On Thu, Apr 28, 2022 at 10:15:03AM +0200, Hans Verkuil wrote: > > Hi Ian, > > > > When I compiled this patch series with smatch I got these warnings: > > > > zoran/videocodec.c:45 videocodec_attach() warn: variable dereferenced before check 'master' (see line 40) > > zoran/videocodec.c:115 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 111) > > zoran/videocodec.c:168 videocodec_register() warn: variable dereferenced before check 'codec' (see line 166) > > zoran/videocodec.c:200 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 198) > > > > And I also got this warning when checking the kerneldoc: > > > > zoran/zoran.h:307: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst > > > > Can you fix this and post a v3? > > > > Thanks! > > > > Hans > > I just resubmitted v3. > > What did you use to see these issues? When I ran the checkpatch script > and compiled, I did not see any of this. > I have written a blog entry about checking kernel code with Smatch: https://staticthinking.wordpress.com/2022/04/25/how-to-run-smatch-on-your-code/ regards, dan carpenter |
From: Ian C. <ia...@li...> - 2022-05-06 05:30:35
|
On Thu, Apr 28, 2022 at 10:15:03AM +0200, Hans Verkuil wrote: > Hi Ian, > > When I compiled this patch series with smatch I got these warnings: > > zoran/videocodec.c:45 videocodec_attach() warn: variable dereferenced before check 'master' (see line 40) > zoran/videocodec.c:115 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 111) > zoran/videocodec.c:168 videocodec_register() warn: variable dereferenced before check 'codec' (see line 166) > zoran/videocodec.c:200 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 198) > > And I also got this warning when checking the kerneldoc: > > zoran/zoran.h:307: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst > > Can you fix this and post a v3? > > Thanks! > > Hans I just resubmitted v3. What did you use to see these issues? When I ran the checkpatch script and compiled, I did not see any of this. Thanks! Ian |
From: Ian C. <ia...@li...> - 2022-05-06 05:29:25
|
This replaces all of the dprintk macro calls with the zrdev_dbg, zrdev_info, or zrdev_err calls as appropriate. This allows for the removal of the dprintk macro from each file it is defined in, along with the removal of module params that track the debugging level. In the case that the debugging level was used in a comparison, this has been replaced with checking the console level debugging and making a decision from there. If the console debugging level is at least the KERN_ debugging level equivalent, then the comparison will evaluate as true. There are a few instances where pr_debug must be used over the zrdev_dbg. These occur in the module cleanup functions because there should be no devices defined once we get here, so we don't have a device to pass to zrdev_dbg. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.c | 70 ++++++------ drivers/staging/media/zoran/zr36016.c | 64 +++++------ drivers/staging/media/zoran/zr36050.c | 139 +++++++++++------------ drivers/staging/media/zoran/zr36060.c | 78 ++++++------- 4 files changed, 170 insertions(+), 181 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 27fdecd2bebe..a0c8bde5ec11 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -16,16 +16,6 @@ #include "videocodec.h" -static int videocodec_debug; -module_param(videocodec_debug, int, 0); -MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (videocodec_debug >= num) \ - printk(format, ##args); \ - } while (0) - struct attached_list { struct videocodec *codec; struct attached_list *next; @@ -59,8 +49,8 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) zr = videocodec_master_to_zoran(master); - dprintk(2, "%s: '%s', flags %lx, magic %lx\n", __func__, - master->name, master->flags, master->magic); + zrdev_dbg(zr, "%s: '%s', flags %lx, magic %lx\n", __func__, + master->name, master->flags, master->magic); if (!h) { zrdev_err(zr, "%s: no device available\n", __func__); @@ -71,7 +61,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) // attach only if the slave has at least the flags // expected by the master if ((master->flags & h->codec->flags) == master->flags) { - dprintk(4, "%s: try '%s'\n", __func__, h->codec->name); + zrdev_dbg(zr, "%s: try '%s'\n", __func__, h->codec->name); codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); if (!codec) @@ -82,7 +72,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) codec->master_data = master; res = codec->setup(codec); if (res == 0) { - dprintk(3, "%s: '%s'\n", __func__, codec->name); + zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name); ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); if (!ptr) goto out_kfree; @@ -91,12 +81,13 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) a = h->list; if (!a) { h->list = ptr; - dprintk(4, "videocodec: first element\n"); + zrdev_dbg(zr, "videocodec: first element\n"); } else { while (a->next) a = a->next; // find end a->next = ptr; - dprintk(4, "videocodec: in after '%s'\n", h->codec->name); + zrdev_dbg(zr, "videocodec: in after '%s'\n", + h->codec->name); } h->attached += 1; @@ -130,8 +121,8 @@ int videocodec_detach(struct videocodec *codec) zr = videocodec_to_zoran(codec); - dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, - codec->name, codec->type, codec->flags, codec->magic); + zrdev_dbg(zr, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, + codec->name, codec->type, codec->flags, codec->magic); if (!h) { zrdev_err(zr, "%s: no device left...\n", __func__); @@ -145,7 +136,8 @@ int videocodec_detach(struct videocodec *codec) if (codec == a->codec) { res = a->codec->unset(a->codec); if (res >= 0) { - dprintk(3, "%s: '%s'\n", __func__, a->codec->name); + zrdev_dbg(zr, "%s: '%s'\n", __func__, + a->codec->name); a->codec->master_data = NULL; } else { zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); @@ -153,10 +145,10 @@ int videocodec_detach(struct videocodec *codec) } if (!prev) { h->list = a->next; - dprintk(4, "videocodec: delete first\n"); + zrdev_dbg(zr, "videocodec: delete first\n"); } else { prev->next = a->next; - dprintk(4, "videocodec: delete middle\n"); + zrdev_dbg(zr, "videocodec: delete middle\n"); } kfree(a->codec); kfree(a); @@ -176,15 +168,18 @@ int videocodec_detach(struct videocodec *codec) int videocodec_register(const struct videocodec *codec) { struct codec_list *ptr, *h = codeclist_top; + struct zoran *zr; if (!codec) { pr_err("%s: no data!\n", __func__); return -EINVAL; } - dprintk(2, - "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", - codec->name, codec->type, codec->flags, codec->magic); + zr = videocodec_to_zoran((struct videocodec *)codec); + + zrdev_dbg(zr, + "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", + codec->name, codec->type, codec->flags, codec->magic); ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); if (!ptr) @@ -193,13 +188,13 @@ int videocodec_register(const struct videocodec *codec) if (!h) { codeclist_top = ptr; - dprintk(4, "videocodec: hooked in as first element\n"); + zrdev_dbg(zr, "videocodec: hooked in as first element\n"); } else { while (h->next) h = h->next; // find the end h->next = ptr; - dprintk(4, "videocodec: hooked in after '%s'\n", - h->codec->name); + zrdev_dbg(zr, "videocodec: hooked in after '%s'\n", + h->codec->name); } return 0; @@ -217,9 +212,9 @@ int videocodec_unregister(const struct videocodec *codec) zr = videocodec_to_zoran((struct videocodec *)codec); - dprintk(2, - "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", - codec->name, codec->type, codec->flags, codec->magic); + zrdev_dbg(zr, + "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", + codec->name, codec->type, codec->flags, codec->magic); if (!h) { zrdev_err(zr, "%s: no device left...\n", __func__); @@ -229,19 +224,20 @@ int videocodec_unregister(const struct videocodec *codec) while (h) { if (codec == h->codec) { if (h->attached) { - zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name); + zrdev_err(zr, "videocodec: '%s' is used\n", + h->codec->name); return -EBUSY; } - dprintk(3, "videocodec: unregister '%s' is ok.\n", - h->codec->name); + zrdev_dbg(zr, "videocodec: unregister '%s' is ok.\n", + h->codec->name); if (!prev) { codeclist_top = h->next; - dprintk(4, - "videocodec: delete first element\n"); + zrdev_dbg(zr, + "videocodec: delete first element\n"); } else { prev->next = h->next; - dprintk(4, - "videocodec: delete middle element\n"); + zrdev_dbg(zr, + "videocodec: delete middle element\n"); } kfree(h); return 0; diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 953d93ccc897..0e0532537a3e 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -22,17 +22,6 @@ /* amount of chips attached via this driver */ static int zr36016_codecs; -static int zr36016_debug; -module_param(zr36016_debug, int, 0); -MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); - - -#define dprintk(num, format, args...) \ - do { \ - if (zr36016_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= Local hardware I/O functions: @@ -51,7 +40,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) else zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); return value; } @@ -60,7 +49,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) @@ -85,7 +74,8 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name); } - dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading indirect from 0x%04x: %02x\n", + ptr->name, reg, value); return value; } @@ -93,8 +83,8 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, - value, reg); + zrdev_dbg(zr, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, + value, reg); /* just in case something is wrong... */ if (ptr->codec->master_data->writereg) { @@ -128,14 +118,14 @@ static int zr36016_basic_test(struct zr36016 *ptr) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - if (zr36016_debug) { + if (*KERN_INFO <= CONSOLE_LOGLEVEL_DEFAULT) { int i; zr36016_writei(ptr, ZR016I_PAX_LO, 0x55); - dprintk(1, KERN_INFO "%s: registers: ", ptr->name); + zrdev_dbg(zr, "%s: registers: ", ptr->name); for (i = 0; i <= 0x0b; i++) - dprintk(1, "%02x ", zr36016_readi(ptr, i)); - dprintk(1, "\n"); + zrdev_dbg(zr, "%02x ", zr36016_readi(ptr, i)); + zrdev_dbg(zr, "\n"); } // for testing just write 0, then the default value to a register and read // it back in both cases @@ -172,10 +162,11 @@ static int zr36016_pushit(struct zr36016 *ptr, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", - ptr->name, startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", + ptr->name, startreg, len); while (i < len) { zr36016_writei(ptr, startreg++, data[i++]); } @@ -233,8 +224,9 @@ static void zr36016_init(struct zr36016 *ptr) static int zr36016_set_mode(struct videocodec *codec, int mode) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) return -EINVAL; @@ -250,11 +242,12 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", - ptr->name, norm->h_start, norm->v_start, - cap->x, cap->y, cap->width, cap->height, - cap->decimation); + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", + ptr->name, norm->h_start, norm->v_start, + cap->x, cap->y, cap->width, cap->height, + cap->decimation); /* if () return -EINVAL; * trust the master driver that it knows what it does - so @@ -284,9 +277,11 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36016_control(struct videocodec *codec, int type, int size, void *data) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", + ptr->name, type, size); switch (type) { case CODEC_G_STATUS: /* get last status - we don't know it ... */ @@ -333,11 +328,12 @@ static int zr36016_control(struct videocodec *codec, int type, int size, void *d static int zr36016_unset(struct videocodec *codec) { struct zr36016 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); kfree(ptr); codec->data = NULL; @@ -363,7 +359,7 @@ static int zr36016_setup(struct videocodec *codec) struct zoran *zr = videocodec_to_zoran(codec); int res; - dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); + zrdev_dbg(zr, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); if (zr36016_codecs == MAX_CODECS) { zrdev_err(zr, "zr36016: Can't attach more codecs!\n"); @@ -393,7 +389,8 @@ static int zr36016_setup(struct videocodec *codec) ptr->ydec = 0; zr36016_init(ptr); - dprintk(1, KERN_INFO "%s: codec v%d attached and running\n", ptr->name, ptr->version); + zrdev_dbg(zr, "%s: codec v%d attached and running\n", + ptr->name, ptr->version); return 0; } @@ -426,9 +423,8 @@ int zr36016_init_module(void) void zr36016_cleanup_module(void) { if (zr36016_codecs) { - dprintk(1, - "zr36016: something's wrong - %d codecs left somehow.\n", - zr36016_codecs); + pr_debug("zr36016: something's wrong - %d codecs left somehow.\n", + zr36016_codecs); } videocodec_unregister(&zr36016_codec); } diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index 4a14fc3bffba..6a7ef28d996c 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -29,17 +29,6 @@ /* amount of chips attached via this driver */ static int zr36050_codecs; -/* debugging is available via module parameter */ -static int zr36050_debug; -module_param(zr36050_debug, int, 0); -MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (zr36050_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= Local hardware I/O functions: @@ -49,32 +38,32 @@ MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); /* read and write functions */ static u8 zr36050_read(struct zr36050 *ptr, u16 reg) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); u8 value = 0; /* just in case something is wrong... */ if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else - dprintk(1, - KERN_ERR "%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); return value; } static void zr36050_write(struct zr36050 *ptr, u16 reg, u8 value) { - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); + struct zoran *zr = videocodec_to_zoran(ptr->codec); + + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); /* just in case something is wrong... */ if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing written!\n", - ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", + ptr->name); } /* ========================================================================= @@ -117,14 +106,15 @@ static u16 zr36050_read_scalefactor(struct zr36050 *ptr) static void zr36050_wait_end(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; while (!(zr36050_read_status1(ptr) & 0x4)) { udelay(1); if (i++ > 200000) { // 200ms, there is for sure something wrong!!! - dprintk(1, - "%s: timeout at wait_end (last status: 0x%02x)\n", - ptr->name, ptr->status1); + zrdev_err(zr, + "%s: timeout at wait_end (last status: 0x%02x)\n", + ptr->name, ptr->status1); break; } } @@ -138,33 +128,32 @@ static void zr36050_wait_end(struct zr36050 *ptr) static int zr36050_basic_test(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + zr36050_write(ptr, ZR050_SOF_IDX, 0x00); zr36050_write(ptr, ZR050_SOF_IDX + 1, 0x00); if ((zr36050_read(ptr, ZR050_SOF_IDX) | zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0x0000) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to jpeg processor!\n", - ptr->name); + zrdev_err(zr, + "%s: attach failed, can't connect to jpeg processor!\n", + ptr->name); return -ENXIO; } zr36050_write(ptr, ZR050_SOF_IDX, 0xff); zr36050_write(ptr, ZR050_SOF_IDX + 1, 0xc0); if (((zr36050_read(ptr, ZR050_SOF_IDX) << 8) | zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0xffc0) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to jpeg processor!\n", - ptr->name); + zrdev_err(zr, + "%s: attach failed, can't connect to jpeg processor!\n", + ptr->name); return -ENXIO; } zr36050_wait_end(ptr); if ((ptr->status1 & 0x4) == 0) { - dprintk(1, - KERN_ERR - "%s: attach failed, jpeg processor failed (end flag)!\n", - ptr->name); + zrdev_err(zr, + "%s: attach failed, jpeg processor failed (end flag)!\n", + ptr->name); return -EBUSY; } @@ -179,10 +168,11 @@ static int zr36050_basic_test(struct zr36050 *ptr) static int zr36050_pushit(struct zr36050 *ptr, u16 startreg, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, - startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, + startreg, len); while (i < len) zr36050_write(ptr, startreg++, data[i++]); @@ -305,11 +295,12 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; static int zr36050_set_sof(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sof_data[34]; // max. size of register set int i; - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, - ptr->width, ptr->height, NO_OF_COMPONENTS); + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, + ptr->width, ptr->height, NO_OF_COMPONENTS); sof_data[0] = 0xff; sof_data[1] = 0xc0; sof_data[2] = 0x00; @@ -336,10 +327,11 @@ static int zr36050_set_sof(struct zr36050 *ptr) static int zr36050_set_sos(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sos_data[16]; // max. size of register set int i; - dprintk(3, "%s: write SOS\n", ptr->name); + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); sos_data[0] = 0xff; sos_data[1] = 0xda; sos_data[2] = 0x00; @@ -363,9 +355,10 @@ static int zr36050_set_sos(struct zr36050 *ptr) static int zr36050_set_dri(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char dri_data[6]; // max. size of register set - dprintk(3, "%s: write DRI\n", ptr->name); + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); dri_data[0] = 0xff; dri_data[1] = 0xdd; dri_data[2] = 0x00; @@ -390,7 +383,7 @@ static void zr36050_init(struct zr36050 *ptr) struct zoran *zr = videocodec_to_zoran(ptr->codec); if (ptr->mode == CODEC_DO_COMPRESSION) { - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); /* 050 communicates with 057 in master mode */ zr36050_write(ptr, ZR050_HARDWARE, ZR050_HW_MSTR); @@ -420,7 +413,7 @@ static void zr36050_init(struct zr36050 *ptr) /* setup the fixed jpeg tables - maybe variable, though - * (see table init section above) */ - dprintk(3, "%s: write DQT, DHT, APP\n", ptr->name); + zrdev_dbg(zr, "%s: write DQT, DHT, APP\n", ptr->name); sum += zr36050_pushit(ptr, ZR050_DQT_IDX, sizeof(zr36050_dqt), zr36050_dqt); sum += zr36050_pushit(ptr, ZR050_DHT_IDX, @@ -443,8 +436,8 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_GO, 1); // launch codec zr36050_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", - ptr->name, ptr->status1); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", + ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -458,9 +451,9 @@ static void zr36050_init(struct zr36050 *ptr) bitcnt = sum << 3; /* need the size in bits */ tmp = bitcnt >> 16; - dprintk(3, - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); + zrdev_dbg(zr, + "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); zr36050_write(ptr, ZR050_TCV_NET_HI, tmp >> 8); zr36050_write(ptr, ZR050_TCV_NET_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -471,8 +464,8 @@ static void zr36050_init(struct zr36050 *ptr) bitcnt -= ((bitcnt * 5) >> 6); // bits without eob tmp = bitcnt >> 16; - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", - ptr->name, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", + ptr->name, bitcnt, tmp); zr36050_write(ptr, ZR050_TCV_DATA_HI, tmp >> 8); zr36050_write(ptr, ZR050_TCV_DATA_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -490,7 +483,7 @@ static void zr36050_init(struct zr36050 *ptr) ((ptr->app.len > 0) ? ZR050_ME_APP : 0) | ((ptr->com.len > 0) ? ZR050_ME_COM : 0)); } else { - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); /* 050 communicates with 055 in master mode */ zr36050_write(ptr, ZR050_HARDWARE, @@ -503,7 +496,7 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_INT_REQ_0, 0); zr36050_write(ptr, ZR050_INT_REQ_1, 3); // low 2 bits always 1 - dprintk(3, "%s: write DHT\n", ptr->name); + zrdev_dbg(zr, "%s: write DHT\n", ptr->name); zr36050_pushit(ptr, ZR050_DHT_IDX, sizeof(zr36050_dht), zr36050_dht); @@ -512,8 +505,8 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_GO, 1); // launch codec zr36050_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", - ptr->name, ptr->status1); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", + ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -540,8 +533,9 @@ static void zr36050_init(struct zr36050 *ptr) static int zr36050_set_mode(struct videocodec *codec, int mode) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) return -EINVAL; @@ -557,12 +551,13 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int size; - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", - ptr->name, norm->h_start, norm->v_start, - cap->x, cap->y, cap->width, cap->height, - cap->decimation, cap->quality); + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", + ptr->name, norm->h_start, norm->v_start, + cap->x, cap->y, cap->width, cap->height, + cap->decimation, cap->quality); /* if () return -EINVAL; * trust the master driver that it knows what it does - so * we allow invalid startx/y and norm for now ... */ @@ -595,10 +590,11 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36050_control(struct videocodec *codec, int type, int size, void *data) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, - size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, + size); switch (type) { case CODEC_G_STATUS: /* get last status */ @@ -714,12 +710,13 @@ static int zr36050_control(struct videocodec *codec, int type, int size, void *d static int zr36050_unset(struct videocodec *codec) { struct zr36050 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, - ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, + ptr->num); kfree(ptr); codec->data = NULL; @@ -742,14 +739,15 @@ static int zr36050_unset(struct videocodec *codec) static int zr36050_setup(struct videocodec *codec) { struct zr36050 *ptr; + struct zoran *zr = videocodec_to_zoran(codec); int res; - dprintk(2, "zr36050: initializing MJPEG subsystem #%d.\n", - zr36050_codecs); + zrdev_dbg(zr, "zr36050: initializing MJPEG subsystem #%d.\n", + zr36050_codecs); if (zr36050_codecs == MAX_CODECS) { - dprintk(1, - KERN_ERR "zr36050: Can't attach more codecs!\n"); + zrdev_err(zr, + "zr36050: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init @@ -790,8 +788,8 @@ static int zr36050_setup(struct videocodec *codec) zr36050_init(ptr); - dprintk(1, KERN_INFO "%s: codec attached and running\n", - ptr->name); + zrdev_info(zr, "%s: codec attached and running\n", + ptr->name); return 0; } @@ -824,9 +822,8 @@ int zr36050_init_module(void) void zr36050_cleanup_module(void) { if (zr36050_codecs) { - dprintk(1, - "zr36050: something's wrong - %d codecs left somehow.\n", - zr36050_codecs); + pr_debug("zr36050: something's wrong - %d codecs left somehow.\n", + zr36050_codecs); } videocodec_unregister(&zr36050_codec); } diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index 8dc3d4a98c47..7798016f1f96 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -32,16 +32,6 @@ static bool low_bitrate; module_param(low_bitrate, bool, 0); MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate"); -static int zr36060_debug; -module_param(zr36060_debug, int, 0); -MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (zr36060_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= * Local hardware I/O functions: * read/write via codec layer (registers are located in the master device) @@ -66,7 +56,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "0x%02x @0x%04x\n", value, reg); + zrdev_dbg(zr, "0x%02x @0x%04x\n", value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) @@ -104,14 +94,15 @@ static u16 zr36060_read_scalefactor(struct zr36060 *ptr) /* wait if codec is ready to proceed (end of processing) or time is over */ static void zr36060_wait_end(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) { udelay(1); if (i++ > 200000) { // 200ms, there is for sure something wrong!!! - dprintk(1, - "%s: timeout at wait_end (last status: 0x%02x)\n", - ptr->name, ptr->status); + zrdev_dbg(zr, + "%s: timeout at wait_end (last status: 0x%02x)\n", + ptr->name, ptr->status); break; } } @@ -140,10 +131,11 @@ static int zr36060_basic_test(struct zr36060 *ptr) /* simple loop for pushing the init datasets */ static int zr36060_pushit(struct zr36060 *ptr, u16 startreg, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, - startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, + startreg, len); while (i < len) zr36060_write(ptr, startreg++, data[i++]); @@ -254,11 +246,12 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; /* SOF (start of frame) segment depends on width, height and sampling ratio of each color component */ static int zr36060_set_sof(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sof_data[34]; // max. size of register set int i; - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, - ptr->width, ptr->height, NO_OF_COMPONENTS); + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, + ptr->width, ptr->height, NO_OF_COMPONENTS); sof_data[0] = 0xff; sof_data[1] = 0xc0; sof_data[2] = 0x00; @@ -282,10 +275,11 @@ static int zr36060_set_sof(struct zr36060 *ptr) /* SOS (start of scan) segment depends on the used scan components of each color component */ static int zr36060_set_sos(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sos_data[16]; // max. size of register set int i; - dprintk(3, "%s: write SOS\n", ptr->name); + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); sos_data[0] = 0xff; sos_data[1] = 0xda; sos_data[2] = 0x00; @@ -307,9 +301,10 @@ static int zr36060_set_sos(struct zr36060 *ptr) /* DRI (define restart interval) */ static int zr36060_set_dri(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char dri_data[6]; // max. size of register set - dprintk(3, "%s: write DRI\n", ptr->name); + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); dri_data[0] = 0xff; dri_data[1] = 0xdd; dri_data[2] = 0x00; @@ -329,7 +324,7 @@ static void zr36060_init(struct zr36060 *ptr) struct zoran *zr = videocodec_to_zoran(ptr->codec); if (ptr->mode == CODEC_DO_COMPRESSION) { - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); @@ -382,9 +377,9 @@ static void zr36060_init(struct zr36060 *ptr) bitcnt = sum << 3; /* need the size in bits */ tmp = bitcnt >> 16; - dprintk(3, - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); + zrdev_dbg(zr, + "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); zr36060_write(ptr, ZR060_TCV_NET_HI, tmp >> 8); zr36060_write(ptr, ZR060_TCV_NET_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -395,8 +390,8 @@ static void zr36060_init(struct zr36060 *ptr) bitcnt -= ((bitcnt * 5) >> 6); // bits without eob tmp = bitcnt >> 16; - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", - ptr->name, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", + ptr->name, bitcnt, tmp); zr36060_write(ptr, ZR060_TCV_DATA_HI, tmp >> 8); zr36060_write(ptr, ZR060_TCV_DATA_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -414,7 +409,7 @@ static void zr36060_init(struct zr36060 *ptr) zr36060_write(ptr, ZR060_VCR, ZR060_VCR_RANGE); } else { - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); @@ -447,7 +442,8 @@ static void zr36060_init(struct zr36060 *ptr) /* Load the tables */ zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST | ZR060_LOAD_LOAD); zr36060_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", + ptr->name, ptr->status); if (ptr->status & ZR060_CFSR_BUSY) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -467,8 +463,9 @@ static void zr36060_init(struct zr36060 *ptr) static int zr36060_set_mode(struct videocodec *codec, int mode) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if (mode != CODEC_DO_EXPANSION && mode != CODEC_DO_COMPRESSION) return -EINVAL; @@ -484,11 +481,12 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); u32 reg; int size; - dprintk(2, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, - cap->x, cap->y, cap->width, cap->height, cap->decimation); + zrdev_dbg(zr, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, + cap->x, cap->y, cap->width, cap->height, cap->decimation); /* if () return -EINVAL; * trust the master driver that it knows what it does - so @@ -643,10 +641,11 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36060_control(struct videocodec *codec, int type, int size, void *data) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, - size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, + size); switch (type) { case CODEC_G_STATUS: /* get last status */ @@ -759,11 +758,12 @@ static int zr36060_control(struct videocodec *codec, int type, int size, void *d static int zr36060_unset(struct videocodec *codec) { struct zr36060 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); kfree(ptr); codec->data = NULL; @@ -787,7 +787,8 @@ static int zr36060_setup(struct videocodec *codec) struct zoran *zr = videocodec_to_zoran(codec); int res; - dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); + zrdev_dbg(zr, "zr36060: initializing MJPEG subsystem #%d.\n", + zr36060_codecs); if (zr36060_codecs == MAX_CODECS) { zrdev_err(zr, "zr36060: Can't attach more codecs!\n"); @@ -830,7 +831,7 @@ static int zr36060_setup(struct videocodec *codec) zr36060_init(ptr); - dprintk(1, KERN_INFO "%s: codec attached and running\n", ptr->name); + zrdev_info(zr, "%s: codec attached and running\n", ptr->name); return 0; } @@ -859,9 +860,8 @@ int zr36060_init_module(void) void zr36060_cleanup_module(void) { if (zr36060_codecs) { - dprintk(1, - "zr36060: something's wrong - %d codecs left somehow.\n", - zr36060_codecs); + pr_debug("zr36060: something's wrong - %d codecs left somehow.\n", + zr36060_codecs); } /* however, we can't just stay alive */ -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-05-06 05:29:11
|
This replaces all of the pr_err calls to the preferred zrdev_err macro that calls the dev_err macro. There are a few locations where the pr_err is left because a zoran struct cannot be created. This is the result of error handling for another struct's existence that is required to create a zoran struct. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.c | 25 +++++++++++++++------- drivers/staging/media/zoran/zr36016.c | 27 ++++++++++++++++-------- drivers/staging/media/zoran/zr36050.c | 5 +++-- drivers/staging/media/zoran/zr36060.c | 19 +++++++++++------ 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 3af7d02bd910..27fdecd2bebe 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -47,6 +47,7 @@ static struct codec_list *codeclist_top; struct videocodec *videocodec_attach(struct videocodec_master *master) { struct codec_list *h = codeclist_top; + struct zoran *zr; struct attached_list *a, *ptr; struct videocodec *codec; int res; @@ -56,11 +57,13 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) return NULL; } + zr = videocodec_master_to_zoran(master); + dprintk(2, "%s: '%s', flags %lx, magic %lx\n", __func__, master->name, master->flags, master->magic); if (!h) { - pr_err("%s: no device available\n", __func__); + zrdev_err(zr, "%s: no device available\n", __func__); return NULL; } @@ -105,7 +108,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) h = h->next; } - pr_err("%s: no codec found!\n", __func__); + zrdev_err(zr, "%s: no codec found!\n", __func__); return NULL; out_kfree: @@ -116,6 +119,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) int videocodec_detach(struct videocodec *codec) { struct codec_list *h = codeclist_top; + struct zoran *zr; struct attached_list *a, *prev; int res; @@ -124,11 +128,13 @@ int videocodec_detach(struct videocodec *codec) return -EINVAL; } + zr = videocodec_to_zoran(codec); + dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, codec->name, codec->type, codec->flags, codec->magic); if (!h) { - pr_err("%s: no device left...\n", __func__); + zrdev_err(zr, "%s: no device left...\n", __func__); return -ENXIO; } @@ -142,7 +148,7 @@ int videocodec_detach(struct videocodec *codec) dprintk(3, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } else { - pr_err("%s: '%s'\n", __func__, a->codec->name); + zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } if (!prev) { @@ -163,7 +169,7 @@ int videocodec_detach(struct videocodec *codec) h = h->next; } - pr_err("%s: given codec not found!\n", __func__); + zrdev_err(zr, "%s: given codec not found!\n", __func__); return -EINVAL; } @@ -202,25 +208,28 @@ int videocodec_register(const struct videocodec *codec) int videocodec_unregister(const struct videocodec *codec) { struct codec_list *prev = NULL, *h = codeclist_top; + struct zoran *zr; if (!codec) { pr_err("%s: no data!\n", __func__); return -EINVAL; } + zr = videocodec_to_zoran((struct videocodec *)codec); + dprintk(2, "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", codec->name, codec->type, codec->flags, codec->magic); if (!h) { - pr_err("%s: no device left...\n", __func__); + zrdev_err(zr, "%s: no device left...\n", __func__); return -ENXIO; } while (h) { if (codec == h->codec) { if (h->attached) { - pr_err("videocodec: '%s' is used\n", h->codec->name); + zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name); return -EBUSY; } dprintk(3, "videocodec: unregister '%s' is ok.\n", @@ -241,7 +250,7 @@ int videocodec_unregister(const struct videocodec *codec) h = h->next; } - pr_err("%s: given codec not found!\n", __func__); + zrdev_err(zr, "%s: given codec not found!\n", __func__); return -EINVAL; } diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 26c7c32b6bc0..953d93ccc897 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -43,12 +43,13 @@ MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); static u8 zr36016_read(struct zr36016 *ptr, u16 reg) { u8 value = 0; + struct zoran *zr = videocodec_to_zoran(ptr->codec); /* just in case something is wrong... */ if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else - pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); @@ -57,13 +58,15 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", ptr->name); } /* indirect read and write functions */ @@ -72,13 +75,14 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) { u8 value = 0; + struct zoran *zr = videocodec_to_zoran(ptr->codec); /* just in case something is wrong... */ if ((ptr->codec->master_data->writereg) && (ptr->codec->master_data->readreg)) { ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR value = (ptr->codec->master_data->readreg(ptr->codec, ZR016_IDATA)) & 0xFF; // DATA } else { - pr_err("%s: invalid I/O setup, nothing read (i)!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name); } dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); @@ -87,6 +91,8 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, value, reg); @@ -95,7 +101,7 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR ptr->codec->master_data->writereg(ptr->codec, ZR016_IDATA, value & 0x0FF); // DATA } else { - pr_err("%s: invalid I/O setup, nothing written (i)!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written (i)!\n", ptr->name); } } @@ -120,6 +126,8 @@ static u8 zr36016_read_version(struct zr36016 *ptr) static int zr36016_basic_test(struct zr36016 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + if (zr36016_debug) { int i; @@ -133,19 +141,19 @@ static int zr36016_basic_test(struct zr36016 *ptr) // it back in both cases zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { - pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } zr36016_writei(ptr, ZR016I_PAX_LO, 0x0d0); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0d0) { - pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } // we allow version numbers from 0-3, should be enough, though zr36016_read_version(ptr); if (ptr->version & 0x0c) { - pr_err("%s: attach failed, suspicious version %d found...\n", ptr->name, - ptr->version); + zrdev_err(zr, "%s: attach failed, suspicious version %d found...\n", ptr->name, + ptr->version); return -ENXIO; } @@ -352,12 +360,13 @@ static int zr36016_unset(struct videocodec *codec) static int zr36016_setup(struct videocodec *codec) { struct zr36016 *ptr; + struct zoran *zr = videocodec_to_zoran(codec); int res; dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); if (zr36016_codecs == MAX_CODECS) { - pr_err("zr36016: Can't attach more codecs!\n"); + zrdev_err(zr, "zr36016: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index 38f7021e7b06..4a14fc3bffba 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -387,6 +387,7 @@ static void zr36050_init(struct zr36050 *ptr) { int sum = 0; long bitcnt, tmp; + struct zoran *zr = videocodec_to_zoran(ptr->codec); if (ptr->mode == CODEC_DO_COMPRESSION) { dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); @@ -446,7 +447,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } @@ -515,7 +516,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index d0c369e31c81..8dc3d4a98c47 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -51,25 +51,28 @@ MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); static u8 zr36060_read(struct zr36060 *ptr, u16 reg) { u8 value = 0; + struct zoran *zr = videocodec_to_zoran(ptr->codec); // just in case something is wrong... if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xff; else - pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); return value; } static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "0x%02x @0x%04x\n", value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", ptr->name); } /* ========================================================================= @@ -117,15 +120,17 @@ static void zr36060_wait_end(struct zr36060 *ptr) /* Basic test of "connectivity", writes/reads to/from memory the SOF marker */ static int zr36060_basic_test(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + if ((zr36060_read(ptr, ZR060_IDR_DEV) != 0x33) && (zr36060_read(ptr, ZR060_IDR_REV) != 0x01)) { - pr_err("%s: attach failed, can't connect to jpeg processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", ptr->name); return -ENXIO; } zr36060_wait_end(ptr); if (ptr->status & ZR060_CFSR_BUSY) { - pr_err("%s: attach failed, jpeg processor failed (end flag)!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, jpeg processor failed (end flag)!\n", ptr->name); return -EBUSY; } @@ -321,6 +326,7 @@ static void zr36060_init(struct zr36060 *ptr) { int sum = 0; long bitcnt, tmp; + struct zoran *zr = videocodec_to_zoran(ptr->codec); if (ptr->mode == CODEC_DO_COMPRESSION) { dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); @@ -444,7 +450,7 @@ static void zr36060_init(struct zr36060 *ptr) dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); if (ptr->status & ZR060_CFSR_BUSY) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } } @@ -778,12 +784,13 @@ static int zr36060_unset(struct videocodec *codec) static int zr36060_setup(struct videocodec *codec) { struct zr36060 *ptr; + struct zoran *zr = videocodec_to_zoran(codec); int res; dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); if (zr36060_codecs == MAX_CODECS) { - pr_err("zr36060: Can't attach more codecs!\n"); + zrdev_err(zr, "zr36060: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-05-06 05:28:38
|
This adds the zrdev_dbg() (pointing to pci_dbg()), zrdev_err() (pointing to pci_err()), and zrdev_info() (pointing to pci_info()) macros to the zoran drivers. These are the preferred method for debugging and this will allow to extract the device from the zoran struct to make the call. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/zoran.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 654c95fa5aba..4f7f71d8e93c 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -19,6 +19,7 @@ #define _BUZ_H_ #include <linux/debugfs.h> +#include <linux/pci.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/videobuf2-core.h> @@ -301,6 +302,18 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) #endif +/* + * Debugging macros + */ +#define zrdev_dbg(zr, format, args...) \ + pci_dbg(zr->pci_dev, format, ##args) \ + +#define zrdev_err(zr, format, args...) \ + pci_err(zr->pci_dev, format, ##args) \ + +#define zrdev_info(zr, format, args...) \ + pci_info(zr->pci_dev, format, ##args) \ + int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir); void zoran_queue_exit(struct zoran *zr); int zr_set_buf(struct zoran *zr); -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-05-06 05:28:37
|
This adds inline functions in the videocodec header file to convert the videocodec and videocodec_master structs to their respective contained zoran struct. This will be used to pass the zoran struct to the zrdev_XXX() macros defined in the zoran header. In the zoran header, the new include is added to ensure all variables can be completely defined with the zoran and videocodec includes where they are located. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.h | 15 +++++++++++++++ drivers/staging/media/zoran/zoran.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 9dea348fee40..5e6057edd339 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -307,4 +307,19 @@ extern int videocodec_unregister(const struct videocodec *); int videocodec_debugfs_show(struct seq_file *m); +#include "zoran.h" +static inline struct zoran *videocodec_master_to_zoran(struct videocodec_master *master) +{ + struct zoran *zr = master->data; + + return zr; +} + +static inline struct zoran *videocodec_to_zoran(struct videocodec *codec) +{ + struct videocodec_master *master = codec->master_data; + + return videocodec_master_to_zoran(master); +} + #endif /*ifndef __LINUX_VIDEOCODEC_H */ diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 4f7f71d8e93c..2a8635d08b73 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -20,6 +20,7 @@ #include <linux/debugfs.h> #include <linux/pci.h> +#include <linux/i2c-algo-bit.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/videobuf2-core.h> -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-05-02 15:44:33
|
On Thu, Apr 28, 2022 at 10:15:03AM +0200, Hans Verkuil wrote: > Hi Ian, > > On 25/04/2022 16:41, Ian Cowan wrote: > > This replaces all of the dprintk() macro calls to the zrdev_dbg(), > > zrdev_info(), or zrdev_err() calls as appropriate. This allows for the > > removal of the dprintk() macro from each file it is defined in, along > > with removal of the module params that track the debugging level. > > > > In the case that a debugging level was used in a comparison, this has > > been replaced with checking the console level debugging and making a > > decision from there. If the console debugging level is at least the > > KERN_ debugging level equivalent, then the comparison will evaluate as > > true. > > > > There are a few instances where pr_debug() must be used over the > > zrdev_dbg(). These occur in the module cleanup functions because there > > should be no devices defined once we get to those modules, so we have no > > devices to pass to zrdev_dbg(). > > When I compiled this patch series with smatch I got these warnings: > > zoran/videocodec.c:45 videocodec_attach() warn: variable dereferenced before check 'master' (see line 40) > zoran/videocodec.c:115 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 111) > zoran/videocodec.c:168 videocodec_register() warn: variable dereferenced before check 'codec' (see line 166) > zoran/videocodec.c:200 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 198) > > And I also got this warning when checking the kerneldoc: > > zoran/zoran.h:307: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst > > Can you fix this and post a v3? > > Thanks! > > Hans I will go through and fix these later today. Thanks! Ian |
From: Hans V. <hve...@xs...> - 2022-04-28 08:15:18
|
Hi Ian, On 25/04/2022 16:41, Ian Cowan wrote: > This replaces all of the dprintk() macro calls to the zrdev_dbg(), > zrdev_info(), or zrdev_err() calls as appropriate. This allows for the > removal of the dprintk() macro from each file it is defined in, along > with removal of the module params that track the debugging level. > > In the case that a debugging level was used in a comparison, this has > been replaced with checking the console level debugging and making a > decision from there. If the console debugging level is at least the > KERN_ debugging level equivalent, then the comparison will evaluate as > true. > > There are a few instances where pr_debug() must be used over the > zrdev_dbg(). These occur in the module cleanup functions because there > should be no devices defined once we get to those modules, so we have no > devices to pass to zrdev_dbg(). When I compiled this patch series with smatch I got these warnings: zoran/videocodec.c:45 videocodec_attach() warn: variable dereferenced before check 'master' (see line 40) zoran/videocodec.c:115 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 111) zoran/videocodec.c:168 videocodec_register() warn: variable dereferenced before check 'codec' (see line 166) zoran/videocodec.c:200 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 198) And I also got this warning when checking the kerneldoc: zoran/zoran.h:307: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Can you fix this and post a v3? Thanks! Hans > > Signed-off-by: Ian Cowan <ia...@li...> > --- > drivers/staging/media/zoran/videocodec.c | 55 ++++------ > drivers/staging/media/zoran/zr36016.c | 60 +++++------ > drivers/staging/media/zoran/zr36050.c | 131 +++++++++++------------ > drivers/staging/media/zoran/zr36060.c | 74 ++++++------- > 4 files changed, 143 insertions(+), 177 deletions(-) > > diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c > index cabb291d302c..64ca3efbd3f5 100644 > --- a/drivers/staging/media/zoran/videocodec.c > +++ b/drivers/staging/media/zoran/videocodec.c > @@ -16,16 +16,6 @@ > > #include "videocodec.h" > > -static int videocodec_debug; > -module_param(videocodec_debug, int, 0); > -MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)"); > - > -#define dprintk(num, format, args...) \ > - do { \ > - if (videocodec_debug >= num) \ > - printk(format, ##args); \ > - } while (0) > - > struct attached_list { > struct videocodec *codec; > struct attached_list *next; > @@ -69,7 +59,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) > // attach only if the slave has at least the flags > // expected by the master > if ((master->flags & h->codec->flags) == master->flags) { > - dprintk(4, "%s: try '%s'\n", __func__, h->codec->name); > + zrdev_dbg(zr, "%s: try '%s'\n", __func__, h->codec->name); > > codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); > if (!codec) > @@ -80,7 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) > codec->master_data = master; > res = codec->setup(codec); > if (res == 0) { > - dprintk(3, "%s: '%s'\n", __func__, codec->name); > + zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name); > ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); > if (!ptr) > goto out_kfree; > @@ -89,12 +79,13 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) > a = h->list; > if (!a) { > h->list = ptr; > - dprintk(4, "videocodec: first element\n"); > + zrdev_dbg(zr, "videocodec: first element\n"); > } else { > while (a->next) > a = a->next; // find end > a->next = ptr; > - dprintk(4, "videocodec: in after '%s'\n", h->codec->name); > + zrdev_dbg(zr, "videocodec: in after '%s'\n", > + h->codec->name); > } > > h->attached += 1; > @@ -126,8 +117,8 @@ int videocodec_detach(struct videocodec *codec) > return -EINVAL; > } > > - dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, > - codec->name, codec->type, codec->flags, codec->magic); > + zrdev_dbg(zr, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, > + codec->name, codec->type, codec->flags, codec->magic); > > if (!h) { > zrdev_err(zr, "%s: no device left...\n", __func__); > @@ -141,7 +132,7 @@ int videocodec_detach(struct videocodec *codec) > if (codec == a->codec) { > res = a->codec->unset(a->codec); > if (res >= 0) { > - dprintk(3, "%s: '%s'\n", __func__, a->codec->name); > + zrdev_dbg(zr, "%s: '%s'\n", __func__, a->codec->name); > a->codec->master_data = NULL; > } else { > zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); > @@ -149,10 +140,10 @@ int videocodec_detach(struct videocodec *codec) > } > if (!prev) { > h->list = a->next; > - dprintk(4, "videocodec: delete first\n"); > + zrdev_dbg(zr, "videocodec: delete first\n"); > } else { > prev->next = a->next; > - dprintk(4, "videocodec: delete middle\n"); > + zrdev_dbg(zr, "videocodec: delete middle\n"); > } > kfree(a->codec); > kfree(a); > @@ -179,9 +170,8 @@ int videocodec_register(const struct videocodec *codec) > return -EINVAL; > } > > - dprintk(2, > - "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", > - codec->name, codec->type, codec->flags, codec->magic); > + zrdev_dbg(zr, "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", > + codec->name, codec->type, codec->flags, codec->magic); > > ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); > if (!ptr) > @@ -190,13 +180,13 @@ int videocodec_register(const struct videocodec *codec) > > if (!h) { > codeclist_top = ptr; > - dprintk(4, "videocodec: hooked in as first element\n"); > + zrdev_dbg(zr, "videocodec: hooked in as first element\n"); > } else { > while (h->next) > h = h->next; // find the end > h->next = ptr; > - dprintk(4, "videocodec: hooked in after '%s'\n", > - h->codec->name); > + zrdev_dbg(zr, "videocodec: hooked in after '%s'\n", > + h->codec->name); > } > > return 0; > @@ -212,9 +202,8 @@ int videocodec_unregister(const struct videocodec *codec) > return -EINVAL; > } > > - dprintk(2, > - "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", > - codec->name, codec->type, codec->flags, codec->magic); > + zrdev_dbg(zr, "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", > + codec->name, codec->type, codec->flags, codec->magic); > > if (!h) { > zrdev_err(zr, "%s: no device left...\n", __func__); > @@ -227,16 +216,14 @@ int videocodec_unregister(const struct videocodec *codec) > zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name); > return -EBUSY; > } > - dprintk(3, "videocodec: unregister '%s' is ok.\n", > - h->codec->name); > + zrdev_dbg(zr, "videocodec: unregister '%s' is ok.\n", > + h->codec->name); > if (!prev) { > codeclist_top = h->next; > - dprintk(4, > - "videocodec: delete first element\n"); > + zrdev_dbg(zr, "videocodec: delete first element\n"); > } else { > prev->next = h->next; > - dprintk(4, > - "videocodec: delete middle element\n"); > + zrdev_dbg(zr, "videocodec: delete middle element\n"); > } > kfree(h); > return 0; > diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c > index 3e3376af0cfa..afdd74e7c59f 100644 > --- a/drivers/staging/media/zoran/zr36016.c > +++ b/drivers/staging/media/zoran/zr36016.c > @@ -22,16 +22,6 @@ > /* amount of chips attached via this driver */ > static int zr36016_codecs; > > -static int zr36016_debug; > -module_param(zr36016_debug, int, 0); > -MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); > - > -#define dprintk(num, format, args...) \ > - do { \ > - if (zr36016_debug >= num) \ > - printk(format, ##args); \ > - } while (0) > - > /* ========================================================================= > Local hardware I/O functions: > > @@ -50,7 +40,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) > else > zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); > > - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); > + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); > > return value; > } > @@ -59,7 +49,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) > { > struct zoran *zr = videocodec_to_zoran(ptr->codec); > > - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); > + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); > > // just in case something is wrong... > if (ptr->codec->master_data->writereg) > @@ -84,7 +74,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) > zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name); > } > > - dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); > + zrdev_dbg(zr, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); > return value; > } > > @@ -92,8 +82,8 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) > { > struct zoran *zr = videocodec_to_zoran(ptr->codec); > > - dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, > - value, reg); > + zrdev_dbg(zr, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, > + value, reg); > > /* just in case something is wrong... */ > if (ptr->codec->master_data->writereg) { > @@ -127,14 +117,14 @@ static int zr36016_basic_test(struct zr36016 *ptr) > { > struct zoran *zr = videocodec_to_zoran(ptr->codec); > > - if (zr36016_debug) { > + if (*KERN_INFO <= CONSOLE_LOGLEVEL_DEFAULT) { > int i; > > zr36016_writei(ptr, ZR016I_PAX_LO, 0x55); > - dprintk(1, KERN_INFO "%s: registers: ", ptr->name); > + zrdev_info(zr, "%s: registers: ", ptr->name); > for (i = 0; i <= 0x0b; i++) > - dprintk(1, "%02x ", zr36016_readi(ptr, i)); > - dprintk(1, "\n"); > + zrdev_dbg(zr, "%02x ", zr36016_readi(ptr, i)); > + zrdev_dbg(zr, "\n"); > } > // for testing just write 0, then the default value to a register and read > // it back in both cases > @@ -171,10 +161,11 @@ static int zr36016_pushit(struct zr36016 *ptr, > u16 len, > const char *data) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > int i = 0; > > - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", > - ptr->name, startreg, len); > + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", > + ptr->name, startreg, len); > while (i < len) { > zr36016_writei(ptr, startreg++, data[i++]); > } > @@ -232,8 +223,9 @@ static void zr36016_init(struct zr36016 *ptr) > static int zr36016_set_mode(struct videocodec *codec, int mode) > { > struct zr36016 *ptr = (struct zr36016 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); > + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); > > if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) > return -EINVAL; > @@ -249,11 +241,12 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm > struct vfe_settings *cap, struct vfe_polarity *pol) > { > struct zr36016 *ptr = (struct zr36016 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", > - ptr->name, norm->h_start, norm->v_start, > - cap->x, cap->y, cap->width, cap->height, > - cap->decimation); > + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", > + ptr->name, norm->h_start, norm->v_start, > + cap->x, cap->y, cap->width, cap->height, > + cap->decimation); > > /* if () return -EINVAL; > * trust the master driver that it knows what it does - so > @@ -283,9 +276,10 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm > static int zr36016_control(struct videocodec *codec, int type, int size, void *data) > { > struct zr36016 *ptr = (struct zr36016 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > int *ival = (int *)data; > > - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, size); > + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, size); > > switch (type) { > case CODEC_G_STATUS: /* get last status - we don't know it ... */ > @@ -332,11 +326,12 @@ static int zr36016_control(struct videocodec *codec, int type, int size, void *d > static int zr36016_unset(struct videocodec *codec) > { > struct zr36016 *ptr = codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > if (ptr) { > /* do wee need some codec deinit here, too ???? */ > > - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); > + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); > kfree(ptr); > codec->data = NULL; > > @@ -362,7 +357,7 @@ static int zr36016_setup(struct videocodec *codec) > struct zr36016 *ptr; > int res; > > - dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); > + zrdev_dbg(zr, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); > > if (zr36016_codecs == MAX_CODECS) { > zrdev_err(zr, "zr36016: Can't attach more codecs!\n"); > @@ -392,7 +387,7 @@ static int zr36016_setup(struct videocodec *codec) > ptr->ydec = 0; > zr36016_init(ptr); > > - dprintk(1, KERN_INFO "%s: codec v%d attached and running\n", ptr->name, ptr->version); > + zrdev_info(zr, "%s: codec v%d attached and running\n", ptr->name, ptr->version); > > return 0; > } > @@ -425,9 +420,8 @@ int zr36016_init_module(void) > void zr36016_cleanup_module(void) > { > if (zr36016_codecs) { > - dprintk(1, > - "zr36016: something's wrong - %d codecs left somehow.\n", > - zr36016_codecs); > + pr_debug("zr36016: something's wrong - %d codecs left somehow.\n", > + zr36016_codecs); > } > videocodec_unregister(&zr36016_codec); > } > diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c > index 950dd79f5c81..b26b0711461c 100644 > --- a/drivers/staging/media/zoran/zr36050.c > +++ b/drivers/staging/media/zoran/zr36050.c > @@ -29,17 +29,6 @@ > /* amount of chips attached via this driver */ > static int zr36050_codecs; > > -/* debugging is available via module parameter */ > -static int zr36050_debug; > -module_param(zr36050_debug, int, 0); > -MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); > - > -#define dprintk(num, format, args...) \ > - do { \ > - if (zr36050_debug >= num) \ > - printk(format, ##args); \ > - } while (0) > - > /* ========================================================================= > Local hardware I/O functions: > > @@ -49,32 +38,32 @@ MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); > /* read and write functions */ > static u8 zr36050_read(struct zr36050 *ptr, u16 reg) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > u8 value = 0; > > /* just in case something is wrong... */ > if (ptr->codec->master_data->readreg) > value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; > else > - dprintk(1, > - KERN_ERR "%s: invalid I/O setup, nothing read!\n", ptr->name); > + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); > > - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); > + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); > > return value; > } > > static void zr36050_write(struct zr36050 *ptr, u16 reg, u8 value) > { > - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > + > + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); > > /* just in case something is wrong... */ > if (ptr->codec->master_data->writereg) > ptr->codec->master_data->writereg(ptr->codec, reg, value); > else > - dprintk(1, > - KERN_ERR > - "%s: invalid I/O setup, nothing written!\n", > - ptr->name); > + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", > + ptr->name); > } > > /* ========================================================================= > @@ -117,14 +106,14 @@ static u16 zr36050_read_scalefactor(struct zr36050 *ptr) > > static void zr36050_wait_end(struct zr36050 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > int i = 0; > > while (!(zr36050_read_status1(ptr) & 0x4)) { > udelay(1); > if (i++ > 200000) { // 200ms, there is for sure something wrong!!! > - dprintk(1, > - "%s: timeout at wait_end (last status: 0x%02x)\n", > - ptr->name, ptr->status1); > + zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n", > + ptr->name, ptr->status1); > break; > } > } > @@ -138,33 +127,29 @@ static void zr36050_wait_end(struct zr36050 *ptr) > > static int zr36050_basic_test(struct zr36050 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > + > zr36050_write(ptr, ZR050_SOF_IDX, 0x00); > zr36050_write(ptr, ZR050_SOF_IDX + 1, 0x00); > if ((zr36050_read(ptr, ZR050_SOF_IDX) | > zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0x0000) { > - dprintk(1, > - KERN_ERR > - "%s: attach failed, can't connect to jpeg processor!\n", > - ptr->name); > + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", > + ptr->name); > return -ENXIO; > } > zr36050_write(ptr, ZR050_SOF_IDX, 0xff); > zr36050_write(ptr, ZR050_SOF_IDX + 1, 0xc0); > if (((zr36050_read(ptr, ZR050_SOF_IDX) << 8) | > zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0xffc0) { > - dprintk(1, > - KERN_ERR > - "%s: attach failed, can't connect to jpeg processor!\n", > - ptr->name); > + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", > + ptr->name); > return -ENXIO; > } > > zr36050_wait_end(ptr); > if ((ptr->status1 & 0x4) == 0) { > - dprintk(1, > - KERN_ERR > - "%s: attach failed, jpeg processor failed (end flag)!\n", > - ptr->name); > + zrdev_err(zr, "%s: attach failed, jpeg processor failed (end flag)!\n", > + ptr->name); > return -EBUSY; > } > > @@ -179,10 +164,11 @@ static int zr36050_basic_test(struct zr36050 *ptr) > > static int zr36050_pushit(struct zr36050 *ptr, u16 startreg, u16 len, const char *data) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > int i = 0; > > - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, > - startreg, len); > + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, > + startreg, len); > while (i < len) > zr36050_write(ptr, startreg++, data[i++]); > > @@ -305,11 +291,12 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; > > static int zr36050_set_sof(struct zr36050 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char sof_data[34]; // max. size of register set > int i; > > - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, > - ptr->width, ptr->height, NO_OF_COMPONENTS); > + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, > + ptr->width, ptr->height, NO_OF_COMPONENTS); > sof_data[0] = 0xff; > sof_data[1] = 0xc0; > sof_data[2] = 0x00; > @@ -336,10 +323,11 @@ static int zr36050_set_sof(struct zr36050 *ptr) > > static int zr36050_set_sos(struct zr36050 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char sos_data[16]; // max. size of register set > int i; > > - dprintk(3, "%s: write SOS\n", ptr->name); > + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); > sos_data[0] = 0xff; > sos_data[1] = 0xda; > sos_data[2] = 0x00; > @@ -363,9 +351,10 @@ static int zr36050_set_sos(struct zr36050 *ptr) > > static int zr36050_set_dri(struct zr36050 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char dri_data[6]; // max. size of register set > > - dprintk(3, "%s: write DRI\n", ptr->name); > + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); > dri_data[0] = 0xff; > dri_data[1] = 0xdd; > dri_data[2] = 0x00; > @@ -390,7 +379,7 @@ static void zr36050_init(struct zr36050 *ptr) > long bitcnt, tmp; > > if (ptr->mode == CODEC_DO_COMPRESSION) { > - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); > + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); > > /* 050 communicates with 057 in master mode */ > zr36050_write(ptr, ZR050_HARDWARE, ZR050_HW_MSTR); > @@ -420,7 +409,7 @@ static void zr36050_init(struct zr36050 *ptr) > > /* setup the fixed jpeg tables - maybe variable, though - > * (see table init section above) */ > - dprintk(3, "%s: write DQT, DHT, APP\n", ptr->name); > + zrdev_dbg(zr, "%s: write DQT, DHT, APP\n", ptr->name); > sum += zr36050_pushit(ptr, ZR050_DQT_IDX, > sizeof(zr36050_dqt), zr36050_dqt); > sum += zr36050_pushit(ptr, ZR050_DHT_IDX, > @@ -443,8 +432,8 @@ static void zr36050_init(struct zr36050 *ptr) > > zr36050_write(ptr, ZR050_GO, 1); // launch codec > zr36050_wait_end(ptr); > - dprintk(2, "%s: Status after table preload: 0x%02x\n", > - ptr->name, ptr->status1); > + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", > + ptr->name, ptr->status1); > > if ((ptr->status1 & 0x4) == 0) { > zrdev_err(zr, "%s: init aborted!\n", ptr->name); > @@ -458,9 +447,8 @@ static void zr36050_init(struct zr36050 *ptr) > bitcnt = sum << 3; /* need the size in bits */ > > tmp = bitcnt >> 16; > - dprintk(3, > - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", > - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); > + zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", > + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); > zr36050_write(ptr, ZR050_TCV_NET_HI, tmp >> 8); > zr36050_write(ptr, ZR050_TCV_NET_MH, tmp & 0xff); > tmp = bitcnt & 0xffff; > @@ -471,8 +459,8 @@ static void zr36050_init(struct zr36050 *ptr) > bitcnt -= ((bitcnt * 5) >> 6); // bits without eob > > tmp = bitcnt >> 16; > - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", > - ptr->name, bitcnt, tmp); > + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", > + ptr->name, bitcnt, tmp); > zr36050_write(ptr, ZR050_TCV_DATA_HI, tmp >> 8); > zr36050_write(ptr, ZR050_TCV_DATA_MH, tmp & 0xff); > tmp = bitcnt & 0xffff; > @@ -490,7 +478,7 @@ static void zr36050_init(struct zr36050 *ptr) > ((ptr->app.len > 0) ? ZR050_ME_APP : 0) | > ((ptr->com.len > 0) ? ZR050_ME_COM : 0)); > } else { > - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); > + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); > > /* 050 communicates with 055 in master mode */ > zr36050_write(ptr, ZR050_HARDWARE, > @@ -503,7 +491,7 @@ static void zr36050_init(struct zr36050 *ptr) > zr36050_write(ptr, ZR050_INT_REQ_0, 0); > zr36050_write(ptr, ZR050_INT_REQ_1, 3); // low 2 bits always 1 > > - dprintk(3, "%s: write DHT\n", ptr->name); > + zrdev_dbg(zr, "%s: write DHT\n", ptr->name); > zr36050_pushit(ptr, ZR050_DHT_IDX, sizeof(zr36050_dht), > zr36050_dht); > > @@ -512,8 +500,8 @@ static void zr36050_init(struct zr36050 *ptr) > > zr36050_write(ptr, ZR050_GO, 1); // launch codec > zr36050_wait_end(ptr); > - dprintk(2, "%s: Status after table preload: 0x%02x\n", > - ptr->name, ptr->status1); > + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", > + ptr->name, ptr->status1); > > if ((ptr->status1 & 0x4) == 0) { > zrdev_err(zr, "%s: init aborted!\n", ptr->name); > @@ -540,8 +528,9 @@ static void zr36050_init(struct zr36050 *ptr) > static int zr36050_set_mode(struct videocodec *codec, int mode) > { > struct zr36050 *ptr = (struct zr36050 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); > + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); > > if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) > return -EINVAL; > @@ -557,12 +546,13 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm > struct vfe_settings *cap, struct vfe_polarity *pol) > { > struct zr36050 *ptr = (struct zr36050 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > int size; > > - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", > - ptr->name, norm->h_start, norm->v_start, > - cap->x, cap->y, cap->width, cap->height, > - cap->decimation, cap->quality); > + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", > + ptr->name, norm->h_start, norm->v_start, > + cap->x, cap->y, cap->width, cap->height, > + cap->decimation, cap->quality); > /* if () return -EINVAL; > * trust the master driver that it knows what it does - so > * we allow invalid startx/y and norm for now ... */ > @@ -595,10 +585,11 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm > static int zr36050_control(struct videocodec *codec, int type, int size, void *data) > { > struct zr36050 *ptr = (struct zr36050 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > int *ival = (int *)data; > > - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, > - size); > + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, > + size); > > switch (type) { > case CODEC_G_STATUS: /* get last status */ > @@ -714,12 +705,12 @@ static int zr36050_control(struct videocodec *codec, int type, int size, void *d > static int zr36050_unset(struct videocodec *codec) > { > struct zr36050 *ptr = codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > if (ptr) { > /* do wee need some codec deinit here, too ???? */ > > - dprintk(1, "%s: finished codec #%d\n", ptr->name, > - ptr->num); > + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); > kfree(ptr); > codec->data = NULL; > > @@ -742,14 +733,14 @@ static int zr36050_unset(struct videocodec *codec) > static int zr36050_setup(struct videocodec *codec) > { > struct zr36050 *ptr; > + struct zoran *zr = videocodec_to_zoran(codec); > int res; > > - dprintk(2, "zr36050: initializing MJPEG subsystem #%d.\n", > - zr36050_codecs); > + zrdev_dbg(zr, "zr36050: initializing MJPEG subsystem #%d.\n", > + zr36050_codecs); > > if (zr36050_codecs == MAX_CODECS) { > - dprintk(1, > - KERN_ERR "zr36050: Can't attach more codecs!\n"); > + zrdev_err(zr, "zr36050: Can't attach more codecs!\n"); > return -ENOSPC; > } > //mem structure init > @@ -790,8 +781,7 @@ static int zr36050_setup(struct videocodec *codec) > > zr36050_init(ptr); > > - dprintk(1, KERN_INFO "%s: codec attached and running\n", > - ptr->name); > + zrdev_info(zr, "%s: codec attached and running\n", ptr->name); > > return 0; > } > @@ -824,9 +814,8 @@ int zr36050_init_module(void) > void zr36050_cleanup_module(void) > { > if (zr36050_codecs) { > - dprintk(1, > - "zr36050: something's wrong - %d codecs left somehow.\n", > - zr36050_codecs); > + pr_debug("zr36050: something's wrong - %d codecs left somehow.\n", > + zr36050_codecs); > } > videocodec_unregister(&zr36050_codec); > } > diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c > index c09910669585..81e8bfd05d6a 100644 > --- a/drivers/staging/media/zoran/zr36060.c > +++ b/drivers/staging/media/zoran/zr36060.c > @@ -32,16 +32,6 @@ static bool low_bitrate; > module_param(low_bitrate, bool, 0); > MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate"); > > -static int zr36060_debug; > -module_param(zr36060_debug, int, 0); > -MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); > - > -#define dprintk(num, format, args...) \ > - do { \ > - if (zr36060_debug >= num) \ > - printk(format, ##args); \ > - } while (0) > - > /* ========================================================================= > * Local hardware I/O functions: > * read/write via codec layer (registers are located in the master device) > @@ -66,7 +56,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) > { > struct zoran *zr = videocodec_to_zoran(ptr->codec); > > - dprintk(4, "0x%02x @0x%04x\n", value, reg); > + zrdev_dbg(zr, "0x%02x @0x%04x\n", value, reg); > > // just in case something is wrong... > if (ptr->codec->master_data->writereg) > @@ -104,14 +94,14 @@ static u16 zr36060_read_scalefactor(struct zr36060 *ptr) > /* wait if codec is ready to proceed (end of processing) or time is over */ > static void zr36060_wait_end(struct zr36060 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > int i = 0; > > while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) { > udelay(1); > if (i++ > 200000) { // 200ms, there is for sure something wrong!!! > - dprintk(1, > - "%s: timeout at wait_end (last status: 0x%02x)\n", > - ptr->name, ptr->status); > + zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n", > + ptr->name, ptr->status); > break; > } > } > @@ -140,10 +130,11 @@ static int zr36060_basic_test(struct zr36060 *ptr) > /* simple loop for pushing the init datasets */ > static int zr36060_pushit(struct zr36060 *ptr, u16 startreg, u16 len, const char *data) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > int i = 0; > > - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, > - startreg, len); > + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, > + startreg, len); > while (i < len) > zr36060_write(ptr, startreg++, data[i++]); > > @@ -254,11 +245,12 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; > /* SOF (start of frame) segment depends on width, height and sampling ratio of each color component */ > static int zr36060_set_sof(struct zr36060 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char sof_data[34]; // max. size of register set > int i; > > - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, > - ptr->width, ptr->height, NO_OF_COMPONENTS); > + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, > + ptr->width, ptr->height, NO_OF_COMPONENTS); > sof_data[0] = 0xff; > sof_data[1] = 0xc0; > sof_data[2] = 0x00; > @@ -282,10 +274,11 @@ static int zr36060_set_sof(struct zr36060 *ptr) > /* SOS (start of scan) segment depends on the used scan components of each color component */ > static int zr36060_set_sos(struct zr36060 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char sos_data[16]; // max. size of register set > int i; > > - dprintk(3, "%s: write SOS\n", ptr->name); > + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); > sos_data[0] = 0xff; > sos_data[1] = 0xda; > sos_data[2] = 0x00; > @@ -307,9 +300,10 @@ static int zr36060_set_sos(struct zr36060 *ptr) > /* DRI (define restart interval) */ > static int zr36060_set_dri(struct zr36060 *ptr) > { > + struct zoran *zr = videocodec_to_zoran(ptr->codec); > char dri_data[6]; // max. size of register set > > - dprintk(3, "%s: write DRI\n", ptr->name); > + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); > dri_data[0] = 0xff; > dri_data[1] = 0xdd; > dri_data[2] = 0x00; > @@ -329,7 +323,7 @@ static void zr36060_init(struct zr36060 *ptr) > long bitcnt, tmp; > > if (ptr->mode == CODEC_DO_COMPRESSION) { > - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); > + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); > > zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); > > @@ -382,9 +376,8 @@ static void zr36060_init(struct zr36060 *ptr) > bitcnt = sum << 3; /* need the size in bits */ > > tmp = bitcnt >> 16; > - dprintk(3, > - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", > - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); > + zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", > + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); > zr36060_write(ptr, ZR060_TCV_NET_HI, tmp >> 8); > zr36060_write(ptr, ZR060_TCV_NET_MH, tmp & 0xff); > tmp = bitcnt & 0xffff; > @@ -395,8 +388,8 @@ static void zr36060_init(struct zr36060 *ptr) > bitcnt -= ((bitcnt * 5) >> 6); // bits without eob > > tmp = bitcnt >> 16; > - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", > - ptr->name, bitcnt, tmp); > + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", > + ptr->name, bitcnt, tmp); > zr36060_write(ptr, ZR060_TCV_DATA_HI, tmp >> 8); > zr36060_write(ptr, ZR060_TCV_DATA_MH, tmp & 0xff); > tmp = bitcnt & 0xffff; > @@ -414,7 +407,7 @@ static void zr36060_init(struct zr36060 *ptr) > zr36060_write(ptr, ZR060_VCR, ZR060_VCR_RANGE); > > } else { > - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); > + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); > > zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); > > @@ -447,7 +440,7 @@ static void zr36060_init(struct zr36060 *ptr) > /* Load the tables */ > zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST | ZR060_LOAD_LOAD); > zr36060_wait_end(ptr); > - dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); > + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); > > if (ptr->status & ZR060_CFSR_BUSY) { > zrdev_err(zr, "%s: init aborted!\n", ptr->name); > @@ -467,8 +460,9 @@ static void zr36060_init(struct zr36060 *ptr) > static int zr36060_set_mode(struct videocodec *codec, int mode) > { > struct zr36060 *ptr = (struct zr36060 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); > + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); > > if (mode != CODEC_DO_EXPANSION && mode != CODEC_DO_COMPRESSION) > return -EINVAL; > @@ -484,11 +478,12 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm > struct vfe_settings *cap, struct vfe_polarity *pol) > { > struct zr36060 *ptr = (struct zr36060 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > u32 reg; > int size; > > - dprintk(2, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, > - cap->x, cap->y, cap->width, cap->height, cap->decimation); > + zrdev_dbg(zr, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, > + cap->x, cap->y, cap->width, cap->height, cap->decimation); > > /* if () return -EINVAL; > * trust the master driver that it knows what it does - so > @@ -643,10 +638,11 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm > static int zr36060_control(struct videocodec *codec, int type, int size, void *data) > { > struct zr36060 *ptr = (struct zr36060 *)codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > int *ival = (int *)data; > > - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, > - size); > + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, > + size); > > switch (type) { > case CODEC_G_STATUS: /* get last status */ > @@ -759,11 +755,12 @@ static int zr36060_control(struct videocodec *codec, int type, int size, void *d > static int zr36060_unset(struct videocodec *codec) > { > struct zr36060 *ptr = codec->data; > + struct zoran *zr = videocodec_to_zoran(codec); > > if (ptr) { > /* do wee need some codec deinit here, too ???? */ > > - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); > + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); > kfree(ptr); > codec->data = NULL; > > @@ -787,7 +784,7 @@ static int zr36060_setup(struct videocodec *codec) > struct zr36060 *ptr; > int res; > > - dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); > + zrdev_dbg(zr, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); > > if (zr36060_codecs == MAX_CODECS) { > zrdev_err(zr, "zr36060: Can't attach more codecs!\n"); > @@ -830,7 +827,7 @@ static int zr36060_setup(struct videocodec *codec) > > zr36060_init(ptr); > > - dprintk(1, KERN_INFO "%s: codec attached and running\n", ptr->name); > + zrdev_info(zr, "%s: codec attached and running\n", ptr->name); > > return 0; > } > @@ -859,9 +856,8 @@ int zr36060_init_module(void) > void zr36060_cleanup_module(void) > { > if (zr36060_codecs) { > - dprintk(1, > - "zr36060: something's wrong - %d codecs left somehow.\n", > - zr36060_codecs); > + pr_debug("zr36060: something's wrong - %d codecs left somehow.\n", > + zr36060_codecs); > } > > /* however, we can't just stay alive */ |
From: Dan C. <dan...@or...> - 2022-04-26 08:06:04
|
Hi Ian, url: https://github.com/intel-lab-lkp/linux/commits/Ian-Cowan/staging-media-zoran-add-zrdev_dbg-macros/20220425-092814 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 1efba7ef1d7da5944493728c5375fef5b2130de4 config: i386-randconfig-m021-20220425 (https://download.01.org/0day-ci/archive/20220426/202...@in.../config) compiler: gcc-11 (Debian 11.2.0-20) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lk...@in...> Reported-by: Dan Carpenter <dan...@or...> smatch warnings: drivers/staging/media/zoran/videocodec.c:55 videocodec_attach() warn: variable dereferenced before check 'master' (see line 50) drivers/staging/media/zoran/videocodec.c:124 videocodec_detach() warn: variable dereferenced before check 'codec' (see line 120) drivers/staging/media/zoran/videocodec.c:177 videocodec_register() warn: variable dereferenced before check 'codec' (see line 175) drivers/staging/media/zoran/videocodec.c:210 videocodec_unregister() warn: variable dereferenced before check 'codec' (see line 208) vim +/master +55 drivers/staging/media/zoran/videocodec.c 5e195bbddabdd9 Corentin Labbe 2020-09-25 47 struct videocodec *videocodec_attach(struct videocodec_master *master) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 48 { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 49 struct codec_list *h = codeclist_top; a0a095d4ab6241 Ian Cowan 2022-04-23 @50 struct zoran *zr = videocodec_master_to_zoran(master); ^^^^^^ Dereferenced inside function call. 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 51 struct attached_list *a, *ptr; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 52 struct videocodec *codec; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 53 int res; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 54 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 @55 if (!master) { ^^^^^^^ Checked too late. The "master" pointer can't actually be NULL so just delete this if statement. a0a095d4ab6241 Ian Cowan 2022-04-23 56 zrdev_err(zr, "%s: no data\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 57 return NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 58 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 59 a0a095d4ab6241 Ian Cowan 2022-04-23 60 zrdev_dbg(zr, "%s: '%s', flags %lx, magic %lx\n", __func__, 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 61 master->name, master->flags, master->magic); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 62 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 63 if (!h) { a0a095d4ab6241 Ian Cowan 2022-04-23 64 zrdev_err(zr, "%s: no device available\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 65 return NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 66 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 67 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 68 while (h) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 69 // attach only if the slave has at least the flags 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 70 // expected by the master 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 71 if ((master->flags & h->codec->flags) == master->flags) { 5e195bbddabdd9 Corentin Labbe 2020-09-25 72 dprintk(4, "%s: try '%s'\n", __func__, h->codec->name); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 73 5e195bbddabdd9 Corentin Labbe 2020-09-25 74 codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); 5e195bbddabdd9 Corentin Labbe 2020-09-25 75 if (!codec) fe047de480ca23 Corentin Labbe 2021-12-14 76 goto out_kfree; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 77 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 78 res = strlen(codec->name); 5e195bbddabdd9 Corentin Labbe 2020-09-25 79 snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 80 codec->master_data = master; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 81 res = codec->setup(codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 82 if (res == 0) { 5e195bbddabdd9 Corentin Labbe 2020-09-25 83 dprintk(3, "%s: '%s'\n", __func__, codec->name); 5e195bbddabdd9 Corentin Labbe 2020-09-25 84 ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); 5e195bbddabdd9 Corentin Labbe 2020-09-25 85 if (!ptr) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 86 goto out_kfree; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 87 ptr->codec = codec; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 88 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 89 a = h->list; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 90 if (!a) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 91 h->list = ptr; 5e195bbddabdd9 Corentin Labbe 2020-09-25 92 dprintk(4, "videocodec: first element\n"); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 93 } else { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 94 while (a->next) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 95 a = a->next; // find end 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 96 a->next = ptr; 5e195bbddabdd9 Corentin Labbe 2020-09-25 97 dprintk(4, "videocodec: in after '%s'\n", h->codec->name); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 98 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 99 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 100 h->attached += 1; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 101 return codec; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 102 } else { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 103 kfree(codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 104 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 105 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 106 h = h->next; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 107 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 108 a0a095d4ab6241 Ian Cowan 2022-04-23 109 zrdev_err(zr, "%s: no codec found!\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 110 return NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 111 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 112 out_kfree: 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 113 kfree(codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 114 return NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 115 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 116 5e195bbddabdd9 Corentin Labbe 2020-09-25 117 int videocodec_detach(struct videocodec *codec) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 118 { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 119 struct codec_list *h = codeclist_top; a0a095d4ab6241 Ian Cowan 2022-04-23 @120 struct zoran *zr = videocodec_to_zoran(codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 121 struct attached_list *a, *prev; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 122 int res; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 123 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 @124 if (!codec) { The "codec" variable can be NULL so this code can crash. Move the dereference after the check. a0a095d4ab6241 Ian Cowan 2022-04-23 125 zrdev_err(zr, "%s: no data\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 126 return -EINVAL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 127 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 128 5e195bbddabdd9 Corentin Labbe 2020-09-25 129 dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 130 codec->name, codec->type, codec->flags, codec->magic); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 131 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 132 if (!h) { a0a095d4ab6241 Ian Cowan 2022-04-23 133 zrdev_err(zr, "%s: no device left...\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 134 return -ENXIO; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 135 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 136 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 137 while (h) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 138 a = h->list; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 139 prev = NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 140 while (a) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 141 if (codec == a->codec) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 142 res = a->codec->unset(a->codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 143 if (res >= 0) { 5e195bbddabdd9 Corentin Labbe 2020-09-25 144 dprintk(3, "%s: '%s'\n", __func__, a->codec->name); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 145 a->codec->master_data = NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 146 } else { a0a095d4ab6241 Ian Cowan 2022-04-23 147 zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 148 a->codec->master_data = NULL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 149 } 5e195bbddabdd9 Corentin Labbe 2020-09-25 150 if (!prev) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 151 h->list = a->next; 5e195bbddabdd9 Corentin Labbe 2020-09-25 152 dprintk(4, "videocodec: delete first\n"); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 153 } else { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 154 prev->next = a->next; 5e195bbddabdd9 Corentin Labbe 2020-09-25 155 dprintk(4, "videocodec: delete middle\n"); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 156 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 157 kfree(a->codec); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 158 kfree(a); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 159 h->attached -= 1; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 160 return 0; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 161 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 162 prev = a; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 163 a = a->next; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 164 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 165 h = h->next; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 166 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 167 a0a095d4ab6241 Ian Cowan 2022-04-23 168 zrdev_err(zr, "%s: given codec not found!\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 169 return -EINVAL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 170 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 171 5e195bbddabdd9 Corentin Labbe 2020-09-25 172 int videocodec_register(const struct videocodec *codec) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 173 { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 174 struct codec_list *ptr, *h = codeclist_top; a0a095d4ab6241 Ian Cowan 2022-04-23 @175 struct zoran *zr = videocodec_to_zoran((struct videocodec *)codec); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dereference 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 176 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 @177 if (!codec) { Check a0a095d4ab6241 Ian Cowan 2022-04-23 178 zrdev_err(zr, "%s: no data!\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 179 return -EINVAL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 180 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 181 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 182 dprintk(2, 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 183 "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 184 codec->name, codec->type, codec->flags, codec->magic); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 185 5e195bbddabdd9 Corentin Labbe 2020-09-25 186 ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); 5e195bbddabdd9 Corentin Labbe 2020-09-25 187 if (!ptr) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 188 return -ENOMEM; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 189 ptr->codec = codec; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 190 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 191 if (!h) { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 192 codeclist_top = ptr; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 193 dprintk(4, "videocodec: hooked in as first element\n"); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 194 } else { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 195 while (h->next) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 196 h = h->next; // find the end 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 197 h->next = ptr; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 198 dprintk(4, "videocodec: hooked in after '%s'\n", 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 199 h->codec->name); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 200 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 201 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 202 return 0; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 203 } 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 204 5e195bbddabdd9 Corentin Labbe 2020-09-25 205 int videocodec_unregister(const struct videocodec *codec) 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 206 { 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 207 struct codec_list *prev = NULL, *h = codeclist_top; a0a095d4ab6241 Ian Cowan 2022-04-23 @208 struct zoran *zr = videocodec_to_zoran((struct videocodec *)codec); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dereference 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 209 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 @210 if (!codec) { Check a0a095d4ab6241 Ian Cowan 2022-04-23 211 zrdev_err(zr, "%s: no data!\n", __func__); 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 212 return -EINVAL; 61c3b19f7b9eb7 Corentin Labbe 2020-09-25 213 } -- 0-DAY CI Kernel Test Service https://01.org/lkp |
From: Ian C. <ia...@li...> - 2022-04-25 14:41:49
|
This replaces all of the dprintk() macro calls to the zrdev_dbg(), zrdev_info(), or zrdev_err() calls as appropriate. This allows for the removal of the dprintk() macro from each file it is defined in, along with removal of the module params that track the debugging level. In the case that a debugging level was used in a comparison, this has been replaced with checking the console level debugging and making a decision from there. If the console debugging level is at least the KERN_ debugging level equivalent, then the comparison will evaluate as true. There are a few instances where pr_debug() must be used over the zrdev_dbg(). These occur in the module cleanup functions because there should be no devices defined once we get to those modules, so we have no devices to pass to zrdev_dbg(). Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.c | 55 ++++------ drivers/staging/media/zoran/zr36016.c | 60 +++++------ drivers/staging/media/zoran/zr36050.c | 131 +++++++++++------------ drivers/staging/media/zoran/zr36060.c | 74 ++++++------- 4 files changed, 143 insertions(+), 177 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index cabb291d302c..64ca3efbd3f5 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -16,16 +16,6 @@ #include "videocodec.h" -static int videocodec_debug; -module_param(videocodec_debug, int, 0); -MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (videocodec_debug >= num) \ - printk(format, ##args); \ - } while (0) - struct attached_list { struct videocodec *codec; struct attached_list *next; @@ -69,7 +59,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) // attach only if the slave has at least the flags // expected by the master if ((master->flags & h->codec->flags) == master->flags) { - dprintk(4, "%s: try '%s'\n", __func__, h->codec->name); + zrdev_dbg(zr, "%s: try '%s'\n", __func__, h->codec->name); codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL); if (!codec) @@ -80,7 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) codec->master_data = master; res = codec->setup(codec); if (res == 0) { - dprintk(3, "%s: '%s'\n", __func__, codec->name); + zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name); ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); if (!ptr) goto out_kfree; @@ -89,12 +79,13 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) a = h->list; if (!a) { h->list = ptr; - dprintk(4, "videocodec: first element\n"); + zrdev_dbg(zr, "videocodec: first element\n"); } else { while (a->next) a = a->next; // find end a->next = ptr; - dprintk(4, "videocodec: in after '%s'\n", h->codec->name); + zrdev_dbg(zr, "videocodec: in after '%s'\n", + h->codec->name); } h->attached += 1; @@ -126,8 +117,8 @@ int videocodec_detach(struct videocodec *codec) return -EINVAL; } - dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, - codec->name, codec->type, codec->flags, codec->magic); + zrdev_dbg(zr, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__, + codec->name, codec->type, codec->flags, codec->magic); if (!h) { zrdev_err(zr, "%s: no device left...\n", __func__); @@ -141,7 +132,7 @@ int videocodec_detach(struct videocodec *codec) if (codec == a->codec) { res = a->codec->unset(a->codec); if (res >= 0) { - dprintk(3, "%s: '%s'\n", __func__, a->codec->name); + zrdev_dbg(zr, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } else { zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); @@ -149,10 +140,10 @@ int videocodec_detach(struct videocodec *codec) } if (!prev) { h->list = a->next; - dprintk(4, "videocodec: delete first\n"); + zrdev_dbg(zr, "videocodec: delete first\n"); } else { prev->next = a->next; - dprintk(4, "videocodec: delete middle\n"); + zrdev_dbg(zr, "videocodec: delete middle\n"); } kfree(a->codec); kfree(a); @@ -179,9 +170,8 @@ int videocodec_register(const struct videocodec *codec) return -EINVAL; } - dprintk(2, - "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", - codec->name, codec->type, codec->flags, codec->magic); + zrdev_dbg(zr, "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", + codec->name, codec->type, codec->flags, codec->magic); ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); if (!ptr) @@ -190,13 +180,13 @@ int videocodec_register(const struct videocodec *codec) if (!h) { codeclist_top = ptr; - dprintk(4, "videocodec: hooked in as first element\n"); + zrdev_dbg(zr, "videocodec: hooked in as first element\n"); } else { while (h->next) h = h->next; // find the end h->next = ptr; - dprintk(4, "videocodec: hooked in after '%s'\n", - h->codec->name); + zrdev_dbg(zr, "videocodec: hooked in after '%s'\n", + h->codec->name); } return 0; @@ -212,9 +202,8 @@ int videocodec_unregister(const struct videocodec *codec) return -EINVAL; } - dprintk(2, - "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", - codec->name, codec->type, codec->flags, codec->magic); + zrdev_dbg(zr, "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n", + codec->name, codec->type, codec->flags, codec->magic); if (!h) { zrdev_err(zr, "%s: no device left...\n", __func__); @@ -227,16 +216,14 @@ int videocodec_unregister(const struct videocodec *codec) zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name); return -EBUSY; } - dprintk(3, "videocodec: unregister '%s' is ok.\n", - h->codec->name); + zrdev_dbg(zr, "videocodec: unregister '%s' is ok.\n", + h->codec->name); if (!prev) { codeclist_top = h->next; - dprintk(4, - "videocodec: delete first element\n"); + zrdev_dbg(zr, "videocodec: delete first element\n"); } else { prev->next = h->next; - dprintk(4, - "videocodec: delete middle element\n"); + zrdev_dbg(zr, "videocodec: delete middle element\n"); } kfree(h); return 0; diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 3e3376af0cfa..afdd74e7c59f 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -22,16 +22,6 @@ /* amount of chips attached via this driver */ static int zr36016_codecs; -static int zr36016_debug; -module_param(zr36016_debug, int, 0); -MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (zr36016_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= Local hardware I/O functions: @@ -50,7 +40,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) else zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); return value; } @@ -59,7 +49,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) @@ -84,7 +74,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name); } - dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); return value; } @@ -92,8 +82,8 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, - value, reg); + zrdev_dbg(zr, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, + value, reg); /* just in case something is wrong... */ if (ptr->codec->master_data->writereg) { @@ -127,14 +117,14 @@ static int zr36016_basic_test(struct zr36016 *ptr) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - if (zr36016_debug) { + if (*KERN_INFO <= CONSOLE_LOGLEVEL_DEFAULT) { int i; zr36016_writei(ptr, ZR016I_PAX_LO, 0x55); - dprintk(1, KERN_INFO "%s: registers: ", ptr->name); + zrdev_info(zr, "%s: registers: ", ptr->name); for (i = 0; i <= 0x0b; i++) - dprintk(1, "%02x ", zr36016_readi(ptr, i)); - dprintk(1, "\n"); + zrdev_dbg(zr, "%02x ", zr36016_readi(ptr, i)); + zrdev_dbg(zr, "\n"); } // for testing just write 0, then the default value to a register and read // it back in both cases @@ -171,10 +161,11 @@ static int zr36016_pushit(struct zr36016 *ptr, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", - ptr->name, startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", + ptr->name, startreg, len); while (i < len) { zr36016_writei(ptr, startreg++, data[i++]); } @@ -232,8 +223,9 @@ static void zr36016_init(struct zr36016 *ptr) static int zr36016_set_mode(struct videocodec *codec, int mode) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) return -EINVAL; @@ -249,11 +241,12 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", - ptr->name, norm->h_start, norm->v_start, - cap->x, cap->y, cap->width, cap->height, - cap->decimation); + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n", + ptr->name, norm->h_start, norm->v_start, + cap->x, cap->y, cap->width, cap->height, + cap->decimation); /* if () return -EINVAL; * trust the master driver that it knows what it does - so @@ -283,9 +276,10 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36016_control(struct videocodec *codec, int type, int size, void *data) { struct zr36016 *ptr = (struct zr36016 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, size); switch (type) { case CODEC_G_STATUS: /* get last status - we don't know it ... */ @@ -332,11 +326,12 @@ static int zr36016_control(struct videocodec *codec, int type, int size, void *d static int zr36016_unset(struct videocodec *codec) { struct zr36016 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); kfree(ptr); codec->data = NULL; @@ -362,7 +357,7 @@ static int zr36016_setup(struct videocodec *codec) struct zr36016 *ptr; int res; - dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); + zrdev_dbg(zr, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); if (zr36016_codecs == MAX_CODECS) { zrdev_err(zr, "zr36016: Can't attach more codecs!\n"); @@ -392,7 +387,7 @@ static int zr36016_setup(struct videocodec *codec) ptr->ydec = 0; zr36016_init(ptr); - dprintk(1, KERN_INFO "%s: codec v%d attached and running\n", ptr->name, ptr->version); + zrdev_info(zr, "%s: codec v%d attached and running\n", ptr->name, ptr->version); return 0; } @@ -425,9 +420,8 @@ int zr36016_init_module(void) void zr36016_cleanup_module(void) { if (zr36016_codecs) { - dprintk(1, - "zr36016: something's wrong - %d codecs left somehow.\n", - zr36016_codecs); + pr_debug("zr36016: something's wrong - %d codecs left somehow.\n", + zr36016_codecs); } videocodec_unregister(&zr36016_codec); } diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index 950dd79f5c81..b26b0711461c 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -29,17 +29,6 @@ /* amount of chips attached via this driver */ static int zr36050_codecs; -/* debugging is available via module parameter */ -static int zr36050_debug; -module_param(zr36050_debug, int, 0); -MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (zr36050_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= Local hardware I/O functions: @@ -49,32 +38,32 @@ MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)"); /* read and write functions */ static u8 zr36050_read(struct zr36050 *ptr, u16 reg) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); u8 value = 0; /* just in case something is wrong... */ if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else - dprintk(1, - KERN_ERR "%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); - dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); + zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); return value; } static void zr36050_write(struct zr36050 *ptr, u16 reg, u8 value) { - dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); + struct zoran *zr = videocodec_to_zoran(ptr->codec); + + zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); /* just in case something is wrong... */ if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing written!\n", - ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", + ptr->name); } /* ========================================================================= @@ -117,14 +106,14 @@ static u16 zr36050_read_scalefactor(struct zr36050 *ptr) static void zr36050_wait_end(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; while (!(zr36050_read_status1(ptr) & 0x4)) { udelay(1); if (i++ > 200000) { // 200ms, there is for sure something wrong!!! - dprintk(1, - "%s: timeout at wait_end (last status: 0x%02x)\n", - ptr->name, ptr->status1); + zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n", + ptr->name, ptr->status1); break; } } @@ -138,33 +127,29 @@ static void zr36050_wait_end(struct zr36050 *ptr) static int zr36050_basic_test(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + zr36050_write(ptr, ZR050_SOF_IDX, 0x00); zr36050_write(ptr, ZR050_SOF_IDX + 1, 0x00); if ((zr36050_read(ptr, ZR050_SOF_IDX) | zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0x0000) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to jpeg processor!\n", - ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", + ptr->name); return -ENXIO; } zr36050_write(ptr, ZR050_SOF_IDX, 0xff); zr36050_write(ptr, ZR050_SOF_IDX + 1, 0xc0); if (((zr36050_read(ptr, ZR050_SOF_IDX) << 8) | zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0xffc0) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to jpeg processor!\n", - ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", + ptr->name); return -ENXIO; } zr36050_wait_end(ptr); if ((ptr->status1 & 0x4) == 0) { - dprintk(1, - KERN_ERR - "%s: attach failed, jpeg processor failed (end flag)!\n", - ptr->name); + zrdev_err(zr, "%s: attach failed, jpeg processor failed (end flag)!\n", + ptr->name); return -EBUSY; } @@ -179,10 +164,11 @@ static int zr36050_basic_test(struct zr36050 *ptr) static int zr36050_pushit(struct zr36050 *ptr, u16 startreg, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, - startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, + startreg, len); while (i < len) zr36050_write(ptr, startreg++, data[i++]); @@ -305,11 +291,12 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; static int zr36050_set_sof(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sof_data[34]; // max. size of register set int i; - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, - ptr->width, ptr->height, NO_OF_COMPONENTS); + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, + ptr->width, ptr->height, NO_OF_COMPONENTS); sof_data[0] = 0xff; sof_data[1] = 0xc0; sof_data[2] = 0x00; @@ -336,10 +323,11 @@ static int zr36050_set_sof(struct zr36050 *ptr) static int zr36050_set_sos(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sos_data[16]; // max. size of register set int i; - dprintk(3, "%s: write SOS\n", ptr->name); + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); sos_data[0] = 0xff; sos_data[1] = 0xda; sos_data[2] = 0x00; @@ -363,9 +351,10 @@ static int zr36050_set_sos(struct zr36050 *ptr) static int zr36050_set_dri(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char dri_data[6]; // max. size of register set - dprintk(3, "%s: write DRI\n", ptr->name); + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); dri_data[0] = 0xff; dri_data[1] = 0xdd; dri_data[2] = 0x00; @@ -390,7 +379,7 @@ static void zr36050_init(struct zr36050 *ptr) long bitcnt, tmp; if (ptr->mode == CODEC_DO_COMPRESSION) { - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); /* 050 communicates with 057 in master mode */ zr36050_write(ptr, ZR050_HARDWARE, ZR050_HW_MSTR); @@ -420,7 +409,7 @@ static void zr36050_init(struct zr36050 *ptr) /* setup the fixed jpeg tables - maybe variable, though - * (see table init section above) */ - dprintk(3, "%s: write DQT, DHT, APP\n", ptr->name); + zrdev_dbg(zr, "%s: write DQT, DHT, APP\n", ptr->name); sum += zr36050_pushit(ptr, ZR050_DQT_IDX, sizeof(zr36050_dqt), zr36050_dqt); sum += zr36050_pushit(ptr, ZR050_DHT_IDX, @@ -443,8 +432,8 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_GO, 1); // launch codec zr36050_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", - ptr->name, ptr->status1); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", + ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -458,9 +447,8 @@ static void zr36050_init(struct zr36050 *ptr) bitcnt = sum << 3; /* need the size in bits */ tmp = bitcnt >> 16; - dprintk(3, - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); zr36050_write(ptr, ZR050_TCV_NET_HI, tmp >> 8); zr36050_write(ptr, ZR050_TCV_NET_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -471,8 +459,8 @@ static void zr36050_init(struct zr36050 *ptr) bitcnt -= ((bitcnt * 5) >> 6); // bits without eob tmp = bitcnt >> 16; - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", - ptr->name, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", + ptr->name, bitcnt, tmp); zr36050_write(ptr, ZR050_TCV_DATA_HI, tmp >> 8); zr36050_write(ptr, ZR050_TCV_DATA_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -490,7 +478,7 @@ static void zr36050_init(struct zr36050 *ptr) ((ptr->app.len > 0) ? ZR050_ME_APP : 0) | ((ptr->com.len > 0) ? ZR050_ME_COM : 0)); } else { - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); /* 050 communicates with 055 in master mode */ zr36050_write(ptr, ZR050_HARDWARE, @@ -503,7 +491,7 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_INT_REQ_0, 0); zr36050_write(ptr, ZR050_INT_REQ_1, 3); // low 2 bits always 1 - dprintk(3, "%s: write DHT\n", ptr->name); + zrdev_dbg(zr, "%s: write DHT\n", ptr->name); zr36050_pushit(ptr, ZR050_DHT_IDX, sizeof(zr36050_dht), zr36050_dht); @@ -512,8 +500,8 @@ static void zr36050_init(struct zr36050 *ptr) zr36050_write(ptr, ZR050_GO, 1); // launch codec zr36050_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", - ptr->name, ptr->status1); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", + ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -540,8 +528,9 @@ static void zr36050_init(struct zr36050 *ptr) static int zr36050_set_mode(struct videocodec *codec, int mode) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION)) return -EINVAL; @@ -557,12 +546,13 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int size; - dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", - ptr->name, norm->h_start, norm->v_start, - cap->x, cap->y, cap->width, cap->height, - cap->decimation, cap->quality); + zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n", + ptr->name, norm->h_start, norm->v_start, + cap->x, cap->y, cap->width, cap->height, + cap->decimation, cap->quality); /* if () return -EINVAL; * trust the master driver that it knows what it does - so * we allow invalid startx/y and norm for now ... */ @@ -595,10 +585,11 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36050_control(struct videocodec *codec, int type, int size, void *data) { struct zr36050 *ptr = (struct zr36050 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, - size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, + size); switch (type) { case CODEC_G_STATUS: /* get last status */ @@ -714,12 +705,12 @@ static int zr36050_control(struct videocodec *codec, int type, int size, void *d static int zr36050_unset(struct videocodec *codec) { struct zr36050 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, - ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); kfree(ptr); codec->data = NULL; @@ -742,14 +733,14 @@ static int zr36050_unset(struct videocodec *codec) static int zr36050_setup(struct videocodec *codec) { struct zr36050 *ptr; + struct zoran *zr = videocodec_to_zoran(codec); int res; - dprintk(2, "zr36050: initializing MJPEG subsystem #%d.\n", - zr36050_codecs); + zrdev_dbg(zr, "zr36050: initializing MJPEG subsystem #%d.\n", + zr36050_codecs); if (zr36050_codecs == MAX_CODECS) { - dprintk(1, - KERN_ERR "zr36050: Can't attach more codecs!\n"); + zrdev_err(zr, "zr36050: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init @@ -790,8 +781,7 @@ static int zr36050_setup(struct videocodec *codec) zr36050_init(ptr); - dprintk(1, KERN_INFO "%s: codec attached and running\n", - ptr->name); + zrdev_info(zr, "%s: codec attached and running\n", ptr->name); return 0; } @@ -824,9 +814,8 @@ int zr36050_init_module(void) void zr36050_cleanup_module(void) { if (zr36050_codecs) { - dprintk(1, - "zr36050: something's wrong - %d codecs left somehow.\n", - zr36050_codecs); + pr_debug("zr36050: something's wrong - %d codecs left somehow.\n", + zr36050_codecs); } videocodec_unregister(&zr36050_codec); } diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index c09910669585..81e8bfd05d6a 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -32,16 +32,6 @@ static bool low_bitrate; module_param(low_bitrate, bool, 0); MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate"); -static int zr36060_debug; -module_param(zr36060_debug, int, 0); -MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); - -#define dprintk(num, format, args...) \ - do { \ - if (zr36060_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* ========================================================================= * Local hardware I/O functions: * read/write via codec layer (registers are located in the master device) @@ -66,7 +56,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) { struct zoran *zr = videocodec_to_zoran(ptr->codec); - dprintk(4, "0x%02x @0x%04x\n", value, reg); + zrdev_dbg(zr, "0x%02x @0x%04x\n", value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) @@ -104,14 +94,14 @@ static u16 zr36060_read_scalefactor(struct zr36060 *ptr) /* wait if codec is ready to proceed (end of processing) or time is over */ static void zr36060_wait_end(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) { udelay(1); if (i++ > 200000) { // 200ms, there is for sure something wrong!!! - dprintk(1, - "%s: timeout at wait_end (last status: 0x%02x)\n", - ptr->name, ptr->status); + zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n", + ptr->name, ptr->status); break; } } @@ -140,10 +130,11 @@ static int zr36060_basic_test(struct zr36060 *ptr) /* simple loop for pushing the init datasets */ static int zr36060_pushit(struct zr36060 *ptr, u16 startreg, u16 len, const char *data) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int i = 0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, - startreg, len); + zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, + startreg, len); while (i < len) zr36060_write(ptr, startreg++, data[i++]); @@ -254,11 +245,12 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; /* SOF (start of frame) segment depends on width, height and sampling ratio of each color component */ static int zr36060_set_sof(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sof_data[34]; // max. size of register set int i; - dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name, - ptr->width, ptr->height, NO_OF_COMPONENTS); + zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name, + ptr->width, ptr->height, NO_OF_COMPONENTS); sof_data[0] = 0xff; sof_data[1] = 0xc0; sof_data[2] = 0x00; @@ -282,10 +274,11 @@ static int zr36060_set_sof(struct zr36060 *ptr) /* SOS (start of scan) segment depends on the used scan components of each color component */ static int zr36060_set_sos(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char sos_data[16]; // max. size of register set int i; - dprintk(3, "%s: write SOS\n", ptr->name); + zrdev_dbg(zr, "%s: write SOS\n", ptr->name); sos_data[0] = 0xff; sos_data[1] = 0xda; sos_data[2] = 0x00; @@ -307,9 +300,10 @@ static int zr36060_set_sos(struct zr36060 *ptr) /* DRI (define restart interval) */ static int zr36060_set_dri(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); char dri_data[6]; // max. size of register set - dprintk(3, "%s: write DRI\n", ptr->name); + zrdev_dbg(zr, "%s: write DRI\n", ptr->name); dri_data[0] = 0xff; dri_data[1] = 0xdd; dri_data[2] = 0x00; @@ -329,7 +323,7 @@ static void zr36060_init(struct zr36060 *ptr) long bitcnt, tmp; if (ptr->mode == CODEC_DO_COMPRESSION) { - dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name); zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); @@ -382,9 +376,8 @@ static void zr36060_init(struct zr36060 *ptr) bitcnt = sum << 3; /* need the size in bits */ tmp = bitcnt >> 16; - dprintk(3, - "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", - ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n", + ptr->name, sum, ptr->real_code_vol, bitcnt, tmp); zr36060_write(ptr, ZR060_TCV_NET_HI, tmp >> 8); zr36060_write(ptr, ZR060_TCV_NET_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -395,8 +388,8 @@ static void zr36060_init(struct zr36060 *ptr) bitcnt -= ((bitcnt * 5) >> 6); // bits without eob tmp = bitcnt >> 16; - dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n", - ptr->name, bitcnt, tmp); + zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n", + ptr->name, bitcnt, tmp); zr36060_write(ptr, ZR060_TCV_DATA_HI, tmp >> 8); zr36060_write(ptr, ZR060_TCV_DATA_MH, tmp & 0xff); tmp = bitcnt & 0xffff; @@ -414,7 +407,7 @@ static void zr36060_init(struct zr36060 *ptr) zr36060_write(ptr, ZR060_VCR, ZR060_VCR_RANGE); } else { - dprintk(2, "%s: EXPANSION SETUP\n", ptr->name); + zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name); zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST); @@ -447,7 +440,7 @@ static void zr36060_init(struct zr36060 *ptr) /* Load the tables */ zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST | ZR060_LOAD_LOAD); zr36060_wait_end(ptr); - dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); + zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); if (ptr->status & ZR060_CFSR_BUSY) { zrdev_err(zr, "%s: init aborted!\n", ptr->name); @@ -467,8 +460,9 @@ static void zr36060_init(struct zr36060 *ptr) static int zr36060_set_mode(struct videocodec *codec, int mode) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); - dprintk(2, "%s: set_mode %d call\n", ptr->name, mode); + zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode); if (mode != CODEC_DO_EXPANSION && mode != CODEC_DO_COMPRESSION) return -EINVAL; @@ -484,11 +478,12 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); u32 reg; int size; - dprintk(2, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, - cap->x, cap->y, cap->width, cap->height, cap->decimation); + zrdev_dbg(zr, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name, + cap->x, cap->y, cap->width, cap->height, cap->decimation); /* if () return -EINVAL; * trust the master driver that it knows what it does - so @@ -643,10 +638,11 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm static int zr36060_control(struct videocodec *codec, int type, int size, void *data) { struct zr36060 *ptr = (struct zr36060 *)codec->data; + struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data; - dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, - size); + zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, + size); switch (type) { case CODEC_G_STATUS: /* get last status */ @@ -759,11 +755,12 @@ static int zr36060_control(struct videocodec *codec, int type, int size, void *d static int zr36060_unset(struct videocodec *codec) { struct zr36060 *ptr = codec->data; + struct zoran *zr = videocodec_to_zoran(codec); if (ptr) { /* do wee need some codec deinit here, too ???? */ - dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num); + zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num); kfree(ptr); codec->data = NULL; @@ -787,7 +784,7 @@ static int zr36060_setup(struct videocodec *codec) struct zr36060 *ptr; int res; - dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); + zrdev_dbg(zr, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); if (zr36060_codecs == MAX_CODECS) { zrdev_err(zr, "zr36060: Can't attach more codecs!\n"); @@ -830,7 +827,7 @@ static int zr36060_setup(struct videocodec *codec) zr36060_init(ptr); - dprintk(1, KERN_INFO "%s: codec attached and running\n", ptr->name); + zrdev_info(zr, "%s: codec attached and running\n", ptr->name); return 0; } @@ -859,9 +856,8 @@ int zr36060_init_module(void) void zr36060_cleanup_module(void) { if (zr36060_codecs) { - dprintk(1, - "zr36060: something's wrong - %d codecs left somehow.\n", - zr36060_codecs); + pr_debug("zr36060: something's wrong - %d codecs left somehow.\n", + zr36060_codecs); } /* however, we can't just stay alive */ -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-04-25 14:41:35
|
This replaces all of the pr_err() calls to the preferred zrdev_err() macro that calls the dev_dbg() macro. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.c | 32 +++++++++++++----------- drivers/staging/media/zoran/zr36016.c | 28 +++++++++++++-------- drivers/staging/media/zoran/zr36050.c | 5 ++-- drivers/staging/media/zoran/zr36060.c | 19 +++++++++----- 4 files changed, 52 insertions(+), 32 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 3af7d02bd910..cabb291d302c 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -47,20 +47,21 @@ static struct codec_list *codeclist_top; struct videocodec *videocodec_attach(struct videocodec_master *master) { struct codec_list *h = codeclist_top; + struct zoran *zr = videocodec_master_to_zoran(master); struct attached_list *a, *ptr; struct videocodec *codec; int res; if (!master) { - pr_err("%s: no data\n", __func__); + zrdev_err(zr, "%s: no data\n", __func__); return NULL; } - dprintk(2, "%s: '%s', flags %lx, magic %lx\n", __func__, - master->name, master->flags, master->magic); + zrdev_dbg(zr, "%s: '%s', flags %lx, magic %lx\n", __func__, + master->name, master->flags, master->magic); if (!h) { - pr_err("%s: no device available\n", __func__); + zrdev_err(zr, "%s: no device available\n", __func__); return NULL; } @@ -105,7 +106,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) h = h->next; } - pr_err("%s: no codec found!\n", __func__); + zrdev_err(zr, "%s: no codec found!\n", __func__); return NULL; out_kfree: @@ -116,11 +117,12 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) int videocodec_detach(struct videocodec *codec) { struct codec_list *h = codeclist_top; + struct zoran *zr = videocodec_to_zoran(codec); struct attached_list *a, *prev; int res; if (!codec) { - pr_err("%s: no data\n", __func__); + zrdev_err(zr, "%s: no data\n", __func__); return -EINVAL; } @@ -128,7 +130,7 @@ int videocodec_detach(struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic); if (!h) { - pr_err("%s: no device left...\n", __func__); + zrdev_err(zr, "%s: no device left...\n", __func__); return -ENXIO; } @@ -142,7 +144,7 @@ int videocodec_detach(struct videocodec *codec) dprintk(3, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } else { - pr_err("%s: '%s'\n", __func__, a->codec->name); + zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } if (!prev) { @@ -163,16 +165,17 @@ int videocodec_detach(struct videocodec *codec) h = h->next; } - pr_err("%s: given codec not found!\n", __func__); + zrdev_err(zr, "%s: given codec not found!\n", __func__); return -EINVAL; } int videocodec_register(const struct videocodec *codec) { struct codec_list *ptr, *h = codeclist_top; + struct zoran *zr = videocodec_to_zoran((struct videocodec *)codec); if (!codec) { - pr_err("%s: no data!\n", __func__); + zrdev_err(zr, "%s: no data!\n", __func__); return -EINVAL; } @@ -202,9 +205,10 @@ int videocodec_register(const struct videocodec *codec) int videocodec_unregister(const struct videocodec *codec) { struct codec_list *prev = NULL, *h = codeclist_top; + struct zoran *zr = videocodec_to_zoran((struct videocodec *)codec); if (!codec) { - pr_err("%s: no data!\n", __func__); + zrdev_err(zr, "%s: no data!\n", __func__); return -EINVAL; } @@ -213,14 +217,14 @@ int videocodec_unregister(const struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic); if (!h) { - pr_err("%s: no device left...\n", __func__); + zrdev_err(zr, "%s: no device left...\n", __func__); return -ENXIO; } while (h) { if (codec == h->codec) { if (h->attached) { - pr_err("videocodec: '%s' is used\n", h->codec->name); + zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name); return -EBUSY; } dprintk(3, "videocodec: unregister '%s' is ok.\n", @@ -241,7 +245,7 @@ int videocodec_unregister(const struct videocodec *codec) h = h->next; } - pr_err("%s: given codec not found!\n", __func__); + zrdev_err(zr, "%s: given codec not found!\n", __func__); return -EINVAL; } diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 26c7c32b6bc0..3e3376af0cfa 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -26,7 +26,6 @@ static int zr36016_debug; module_param(zr36016_debug, int, 0); MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); - #define dprintk(num, format, args...) \ do { \ if (zr36016_debug >= num) \ @@ -42,13 +41,14 @@ MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)"); /* read and write functions */ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); u8 value = 0; /* just in case something is wrong... */ if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else - pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); @@ -57,13 +57,15 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", ptr->name); } /* indirect read and write functions */ @@ -71,6 +73,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) * writing it all time cost not much and is safer... */ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); u8 value = 0; /* just in case something is wrong... */ @@ -78,7 +81,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR value = (ptr->codec->master_data->readreg(ptr->codec, ZR016_IDATA)) & 0xFF; // DATA } else { - pr_err("%s: invalid I/O setup, nothing read (i)!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name); } dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); @@ -87,6 +90,8 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, value, reg); @@ -95,7 +100,7 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR ptr->codec->master_data->writereg(ptr->codec, ZR016_IDATA, value & 0x0FF); // DATA } else { - pr_err("%s: invalid I/O setup, nothing written (i)!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written (i)!\n", ptr->name); } } @@ -120,6 +125,8 @@ static u8 zr36016_read_version(struct zr36016 *ptr) static int zr36016_basic_test(struct zr36016 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + if (zr36016_debug) { int i; @@ -133,19 +140,19 @@ static int zr36016_basic_test(struct zr36016 *ptr) // it back in both cases zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { - pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } zr36016_writei(ptr, ZR016I_PAX_LO, 0x0d0); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0d0) { - pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } // we allow version numbers from 0-3, should be enough, though zr36016_read_version(ptr); if (ptr->version & 0x0c) { - pr_err("%s: attach failed, suspicious version %d found...\n", ptr->name, - ptr->version); + zrdev_err(zr, "%s: attach failed, suspicious version %d found...\n", ptr->name, + ptr->version); return -ENXIO; } @@ -351,13 +358,14 @@ static int zr36016_unset(struct videocodec *codec) static int zr36016_setup(struct videocodec *codec) { + struct zoran *zr = videocodec_to_zoran(codec); struct zr36016 *ptr; int res; dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); if (zr36016_codecs == MAX_CODECS) { - pr_err("zr36016: Can't attach more codecs!\n"); + zrdev_err(zr, "zr36016: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index 38f7021e7b06..950dd79f5c81 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -385,6 +385,7 @@ static int zr36050_set_dri(struct zr36050 *ptr) ========================================================================= */ static void zr36050_init(struct zr36050 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int sum = 0; long bitcnt, tmp; @@ -446,7 +447,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } @@ -515,7 +516,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index d0c369e31c81..c09910669585 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -50,26 +50,29 @@ MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)"); static u8 zr36060_read(struct zr36060 *ptr, u16 reg) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); u8 value = 0; // just in case something is wrong... if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xff; else - pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name); return value; } static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + dprintk(4, "0x%02x @0x%04x\n", value, reg); // just in case something is wrong... if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); + zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", ptr->name); } /* ========================================================================= @@ -117,15 +120,17 @@ static void zr36060_wait_end(struct zr36060 *ptr) /* Basic test of "connectivity", writes/reads to/from memory the SOF marker */ static int zr36060_basic_test(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); + if ((zr36060_read(ptr, ZR060_IDR_DEV) != 0x33) && (zr36060_read(ptr, ZR060_IDR_REV) != 0x01)) { - pr_err("%s: attach failed, can't connect to jpeg processor!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n", ptr->name); return -ENXIO; } zr36060_wait_end(ptr); if (ptr->status & ZR060_CFSR_BUSY) { - pr_err("%s: attach failed, jpeg processor failed (end flag)!\n", ptr->name); + zrdev_err(zr, "%s: attach failed, jpeg processor failed (end flag)!\n", ptr->name); return -EBUSY; } @@ -319,6 +324,7 @@ static int zr36060_set_dri(struct zr36060 *ptr) */ static void zr36060_init(struct zr36060 *ptr) { + struct zoran *zr = videocodec_to_zoran(ptr->codec); int sum = 0; long bitcnt, tmp; @@ -444,7 +450,7 @@ static void zr36060_init(struct zr36060 *ptr) dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); if (ptr->status & ZR060_CFSR_BUSY) { - pr_err("%s: init aborted!\n", ptr->name); + zrdev_err(zr, "%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } } @@ -777,13 +783,14 @@ static int zr36060_unset(struct videocodec *codec) */ static int zr36060_setup(struct videocodec *codec) { + struct zoran *zr = videocodec_to_zoran(codec); struct zr36060 *ptr; int res; dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); if (zr36060_codecs == MAX_CODECS) { - pr_err("zr36060: Can't attach more codecs!\n"); + zrdev_err(zr, "zr36060: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-04-25 14:41:06
|
This adds inline functions in the videocodec header file to convert the videocodec and videocodec_master structs to their respective contained zoran struct. This will be used to pass the zoran struct to the zrdev_XXX() macros defined in the zoran header. In the zoran header, the new include is added to ensure all variables can be completely defined with the zoran and videocodec includes where they are located. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/videocodec.h | 15 +++++++++++++++ drivers/staging/media/zoran/zoran.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 9dea348fee40..5e6057edd339 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -307,4 +307,19 @@ extern int videocodec_unregister(const struct videocodec *); int videocodec_debugfs_show(struct seq_file *m); +#include "zoran.h" +static inline struct zoran *videocodec_master_to_zoran(struct videocodec_master *master) +{ + struct zoran *zr = master->data; + + return zr; +} + +static inline struct zoran *videocodec_to_zoran(struct videocodec *codec) +{ + struct videocodec_master *master = codec->master_data; + + return videocodec_master_to_zoran(master); +} + #endif /*ifndef __LINUX_VIDEOCODEC_H */ diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 42b86356c022..674658154e88 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -20,6 +20,7 @@ #include <linux/debugfs.h> #include <linux/dev_printk.h> +#include <linux/i2c-algo-bit.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/videobuf2-core.h> -- 2.35.1 |
From: Ian C. <ia...@li...> - 2022-04-25 14:40:42
|
This adds the zrdev_dbg() (pointing to pci_dbg()), zrdev_err() (pointing to pci_err()), and zrdev_info() (pointing to pci_info()) macros to the zoran drivers. These are the preferred method for debugging and this will allow to extract the device from the zoran struct to make the call. Signed-off-by: Ian Cowan <ia...@li...> --- drivers/staging/media/zoran/zoran.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 654c95fa5aba..4f7f71d8e93c 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -19,6 +19,7 @@ #define _BUZ_H_ #include <linux/debugfs.h> +#include <linux/pci.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/videobuf2-core.h> @@ -301,6 +302,18 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) #endif +/** + * Debugging macros + */ +#define zrdev_dbg(zr, format, args...) \ + pci_dbg(zr->pci_dev, format, ##args) \ + +#define zrdev_err(zr, format, args...) \ + pci_err(zr->pci_dev, format, ##args) \ + +#define zrdev_info(zr, format, args...) \ + pci_info(zr->pci_dev, format, ##args) \ + int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir); void zoran_queue_exit(struct zoran *zr); int zr_set_buf(struct zoran *zr); -- 2.35.1 |