2022-04-14 15:41:48

by Michael Straube

[permalink] [raw]
Subject: [PATCH 6/7] staging: r8188eu: always log firmware info

The local static variable log_version prevents logging the firmware
information more than once, e.g. when the device is unplugged and
plugged again. That is not necessary and complicates the code. Remove
it.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/core/rtw_fw.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c
index cbc4980bd938..64963507a346 100644
--- a/drivers/staging/r8188eu/core/rtw_fw.c
+++ b/drivers/staging/r8188eu/core/rtw_fw.c
@@ -239,7 +239,6 @@ int rtl8188e_firmware_download(struct adapter *padapter)
struct rt_firmware_hdr *fwhdr = NULL;
u8 *fw_data;
u32 fw_size;
- static int log_version;

if (!dvobj->firmware.data)
ret = load_firmware(&dvobj->firmware, device);
@@ -253,10 +252,9 @@ int rtl8188e_firmware_download(struct adapter *padapter)
/* To Check Fw header. Added by tynli. 2009.12.04. */
fwhdr = (struct rt_firmware_hdr *)dvobj->firmware.data;

- if (!log_version++)
- pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
- DRIVER_PREFIX, le16_to_cpu(fwhdr->version), fwhdr->subversion,
- le16_to_cpu(fwhdr->signature));
+ pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
+ DRIVER_PREFIX, le16_to_cpu(fwhdr->version), fwhdr->subversion,
+ le16_to_cpu(fwhdr->signature));

if (IS_FW_HEADER_EXIST(fwhdr)) {
fw_data = fw_data + sizeof(struct rt_firmware_hdr);
--
2.35.1


2022-04-15 21:46:32

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH 6/7] staging: r8188eu: always log firmware info

Hi Larry,

On 4/14/22 18:36, Larry Finger wrote:
> On 4/14/22 03:38, Michael Straube wrote:
>> The local static variable log_version prevents logging the firmware
>> information more than once, e.g. when the device is unplugged and
>> plugged again. That is not necessary and complicates the code. Remove
>> it.
>
> I think the slight complication of the code, one static variable and one if
> statement, is worth not spamming the logs. My recollection is that there are
> other cases besides unplugging and replugging that lead to the firmware being
> reloaded.
>


What about pr_info_once? Anyway even with old code message printed only
once per driver load





With regards,
Pavel Skripkin

2022-04-16 01:47:48

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 6/7] staging: r8188eu: always log firmware info

On 4/14/22 03:38, Michael Straube wrote:
> The local static variable log_version prevents logging the firmware
> information more than once, e.g. when the device is unplugged and
> plugged again. That is not necessary and complicates the code. Remove
> it.

I think the slight complication of the code, one static variable and one if
statement, is worth not spamming the logs. My recollection is that there are
other cases besides unplugging and replugging that lead to the firmware being
reloaded.

Larry