From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Robert Schlabbach <robert_s@gmx.net>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/3] media: si2157: move firmware load to a separate function
Date: Wed, 8 Dec 2021 18:03:48 +0100 [thread overview]
Message-ID: <20211208180348.217c8d86@coco.lan> (raw)
In-Reply-To: <trinity-6e9f5250-2524-47a2-9c0b-ba5ee2346cee-1638981656579@3c-app-gmx-bs36>
Em Wed, 8 Dec 2021 17:40:56 +0100
Robert Schlabbach <robert_s@gmx.net> escreveu:
> > @@ -181,45 +228,13 @@ static int si2157_init(struct dvb_frontend *fe)
> > if (fw_name == NULL)
> > goto skip_fw_download;
>
> You can invert the condition now and put the si2157_load_firmware() call
> inside the if () block, and do away with the goto.
I know, but this would also require to move the dont_load_firmware check,
which also does the goto.
I did that on a first version of the patch, but ended reverting,
as I can't be 100% certain devices with dont_load_firmware:
if ((le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_DEXATEK &&
le16_to_cpu(d->udev->descriptor.idProduct) == 0x0100) ||
(le16_to_cpu(d->udev->descriptor.idVendor) == USB_VID_TERRATEC &&
le16_to_cpu(d->udev->descriptor.idProduct) == USB_PID_TERRATEC_CINERGY_TC2_STICK))
si2157_config.dont_load_firmware = true;
Would keep work and report the hardware type/review.
> > - /* request the firmware, this will block and timeout */
> > - ret = request_firmware(&fw, fw_name, &client->dev);
> > + ret = si2157_load_firmware(fe, fw_name);
> > if (ret) {
> > dev_err(&client->dev, "firmware file '%s' not found\n",
>
> This will produce duplicate error messages, because the called function
> will already output some error messages. You should move this line to
> the extracted function as well, and reduce the code in the init function
> to:
>
> if (fw_name != null) {
> ret = si2157_load_firmware(fe, fw_name);
> if (ret)
> goto err;
> }
True, but I guess patch 3 fixes it.
On patch 1, my goal were just to place everything on a single routine
without any real changes. Patch 3 does the optimization/cleanup.
Thanks,
Mauro
next prev parent reply other threads:[~2021-12-08 17:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 21:10 [PATCH 2/2] media: si2157: Add optional firmware download Robert Schlabbach
2021-12-06 14:00 ` Mauro Carvalho Chehab
2021-12-07 23:07 ` Aw: " Robert Schlabbach
2021-12-08 8:52 ` Mauro Carvalho Chehab
2021-12-08 15:42 ` Aw: " Robert Schlabbach
2021-12-08 10:13 ` [PATCH 0/3] media: si2157: rework firmware load logic Mauro Carvalho Chehab
2021-12-08 10:13 ` [PATCH 1/3] media: si2157: move firmware load to a separate function Mauro Carvalho Chehab
2021-12-08 16:40 ` Robert Schlabbach
2021-12-08 17:03 ` Mauro Carvalho Chehab [this message]
2021-12-08 10:13 ` [PATCH 2/3] media: si2157: Add optional firmware download Mauro Carvalho Chehab
2021-12-08 16:45 ` Robert Schlabbach
2021-12-08 17:09 ` Mauro Carvalho Chehab
2021-12-08 10:13 ` [PATCH 3/3] media: si2157: rework the firmware load logic Mauro Carvalho Chehab
2021-12-08 22:37 ` Robert Schlabbach
2021-12-09 11:34 ` Mauro Carvalho Chehab
2021-12-09 19:37 ` Robert Schlabbach
2021-12-10 6:45 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211208180348.217c8d86@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=robert_s@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.