Remove checkpatch check "CHECK: Lines should not end with a '('" with
argument present in next line and reorganize characters so the lines
are under 100 columns
Signed-off-by: Beatriz Martins de Carvalho <[email protected]>
---
drivers/staging/media/omap4iss/iss.c | 46 +++++++++++++---------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index dae9073e7d3c..e8f724dbf810 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
ISS_HL_SYSCONFIG_SOFTRESET);
- timeout = iss_poll_condition_timeout(
- !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
- ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
+ timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
+ OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG)
+ & ISS_HL_SYSCONFIG_SOFTRESET),
+ 1000, 10, 100);
if (timeout) {
dev_err(iss->dev, "ISS reset timeout\n");
return -ETIMEDOUT;
@@ -583,9 +584,10 @@ static int iss_isp_reset(struct iss_device *iss)
iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, ISP5_CTRL_MSTANDBY);
- timeout = iss_poll_condition_timeout(
- iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) &
- ISP5_CTRL_MSTANDBY_WAIT, 1000000, 1000, 1500);
+ timeout = iss_poll_condition_timeout(iss_reg_read(iss,
+ OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL)
+ & ISP5_CTRL_MSTANDBY_WAIT, 1000000,
+ 1000, 1500);
if (timeout) {
dev_err(iss->dev, "ISP5 standby timeout\n");
return -ETIMEDOUT;
@@ -595,9 +597,10 @@ static int iss_isp_reset(struct iss_device *iss)
iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG,
ISP5_SYSCONFIG_SOFTRESET);
- timeout = iss_poll_condition_timeout(
- !(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) &
- ISP5_SYSCONFIG_SOFTRESET), 1000000, 1000, 1500);
+ timeout = iss_poll_condition_timeout(!(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1,
+ ISP5_SYSCONFIG) &
+ ISP5_SYSCONFIG_SOFTRESET), 1000000,
+ 1000, 1500);
if (timeout) {
dev_err(iss->dev, "ISP5 reset timeout\n");
return -ETIMEDOUT;
@@ -1104,33 +1107,28 @@ static int iss_create_links(struct iss_device *iss)
}
/* Connect the submodules. */
- ret = media_create_pad_link(
- &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
- &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+ ret = media_create_pad_link(&iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
+ &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
if (ret < 0)
return ret;
- ret = media_create_pad_link(
- &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
- &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+ ret = media_create_pad_link(&iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
+ &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
if (ret < 0)
return ret;
- ret = media_create_pad_link(
- &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
- &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+ ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+ &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
if (ret < 0)
return ret;
- ret = media_create_pad_link(
- &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
- &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
+ ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+ &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
if (ret < 0)
return ret;
- ret = media_create_pad_link(
- &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
- &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+ ret = media_create_pad_link(&iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
+ &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
if (ret < 0)
return ret;
--
2.25.1
On Thu, Apr 01, 2021 at 04:07:38PM +0100, Beatriz Martins de Carvalho wrote:
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index dae9073e7d3c..e8f724dbf810 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
> iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
> ISS_HL_SYSCONFIG_SOFTRESET);
>
> - timeout = iss_poll_condition_timeout(
> - !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
> - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
> + OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG)
> + & ISS_HL_SYSCONFIG_SOFTRESET),
> + 1000, 10, 100);
This is not a readability improvment. I would factor it out into its
own function.
Em 01/04/21 16:28, Matthew Wilcox escreveu:
> On Thu, Apr 01, 2021 at 04:07:38PM +0100, Beatriz Martins de Carvalho wrote:
>> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
>> index dae9073e7d3c..e8f724dbf810 100644
>> --- a/drivers/staging/media/omap4iss/iss.c
>> +++ b/drivers/staging/media/omap4iss/iss.c
>> @@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
>> iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
>> ISS_HL_SYSCONFIG_SOFTRESET);
>>
>> - timeout = iss_poll_condition_timeout(
>> - !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
>> - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
>> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
>> + OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG)
>> + & ISS_HL_SYSCONFIG_SOFTRESET),
>> + 1000, 10, 100);
> This is not a readability improvment. I would factor it out into its
> own function.
Thanks for the review. How can I do this? I don't know how to do this.
Beatriz Martins de Carvalho
On Wed, 7 Apr 2021, Beatriz Martins de Carvalho wrote:
>
> Em 01/04/21 16:28, Matthew Wilcox escreveu:
> > On Thu, Apr 01, 2021 at 04:07:38PM +0100, Beatriz Martins de Carvalho wrote:
> > > diff --git a/drivers/staging/media/omap4iss/iss.c
> > > b/drivers/staging/media/omap4iss/iss.c
> > > index dae9073e7d3c..e8f724dbf810 100644
> > > --- a/drivers/staging/media/omap4iss/iss.c
> > > +++ b/drivers/staging/media/omap4iss/iss.c
> > > @@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
> > > iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
> > > ISS_HL_SYSCONFIG_SOFTRESET);
> > > - timeout = iss_poll_condition_timeout(
> > > - !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
> > > - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
> > > + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
> > > + OMAP4_ISS_MEM_TOP,
> > > ISS_HL_SYSCONFIG)
> > > + &
> > > ISS_HL_SYSCONFIG_SOFTRESET),
> > > + 1000, 10, 100);
> > This is not a readability improvment. I would factor it out into its
> > own function.
>
> Thanks for the review. How can I do this? I don't know how to do this.
Copy the code into a new function. Then see what parameters this function
needs for the various information it requires. The code will produce some
results that are needed by the rest of the program. So you have to
arrange via the return value that the proper variables are initialized
after the function call.
For example,
x = a + b;
could become
int f(int a, int b) {
return a + b;
}
x = f(a,b);
That is a pretty silly change, but it gives the idea.
julia
> Beatriz Martins de Carvalho
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/outreachy-kernel/e175859f-4f68-0408-415f-a3e19f7e4874%40gmail.com.
>
Hi Beatriz,
I'm now reviewing staging/media patches instead of Greg KH. See Vaishali's
email from today: "Sending patches for the drivers/staging/media".
On 01/04/2021 17:07, Beatriz Martins de Carvalho wrote:
> Remove checkpatch check "CHECK: Lines should not end with a '('" with
> argument present in next line and reorganize characters so the lines
> are under 100 columns
>
> Signed-off-by: Beatriz Martins de Carvalho <[email protected]>
> ---
> drivers/staging/media/omap4iss/iss.c | 46 +++++++++++++---------------
> 1 file changed, 22 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index dae9073e7d3c..e8f724dbf810 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
> iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
> ISS_HL_SYSCONFIG_SOFTRESET);
>
> - timeout = iss_poll_condition_timeout(
> - !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
> - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
> + OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG)
> + & ISS_HL_SYSCONFIG_SOFTRESET),
> + 1000, 10, 100);
> if (timeout) {
> dev_err(iss->dev, "ISS reset timeout\n");
> return -ETIMEDOUT;
> @@ -583,9 +584,10 @@ static int iss_isp_reset(struct iss_device *iss)
>
> iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, ISP5_CTRL_MSTANDBY);
>
> - timeout = iss_poll_condition_timeout(
> - iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) &
> - ISP5_CTRL_MSTANDBY_WAIT, 1000000, 1000, 1500);
> + timeout = iss_poll_condition_timeout(iss_reg_read(iss,
> + OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL)
> + & ISP5_CTRL_MSTANDBY_WAIT, 1000000,
> + 1000, 1500);
> if (timeout) {
> dev_err(iss->dev, "ISP5 standby timeout\n");
> return -ETIMEDOUT;
> @@ -595,9 +597,10 @@ static int iss_isp_reset(struct iss_device *iss)
> iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG,
> ISP5_SYSCONFIG_SOFTRESET);
>
> - timeout = iss_poll_condition_timeout(
> - !(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) &
> - ISP5_SYSCONFIG_SOFTRESET), 1000000, 1000, 1500);
> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1,
> + ISP5_SYSCONFIG) &
> + ISP5_SYSCONFIG_SOFTRESET), 1000000,
> + 1000, 1500);
As several other people already commented, these changes do not improve readability.
Just leave this code alone, it's good enough. Even splitting up the condition into
a separate function would degrade readability since that would make it harder to
discover the exact condition that will be polled for.
Not everything that checkpatch.pl flags is necessarily bad code :-)
> if (timeout) {
> dev_err(iss->dev, "ISP5 reset timeout\n");
> return -ETIMEDOUT;
> @@ -1104,33 +1107,28 @@ static int iss_create_links(struct iss_device *iss)
> }
>
> /* Connect the submodules. */
> - ret = media_create_pad_link(
> - &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
> + ret = media_create_pad_link(&iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
> + &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
> if (ret < 0)
> return ret;
>
> - ret = media_create_pad_link(
> - &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
> + ret = media_create_pad_link(&iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
> + &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
> if (ret < 0)
> return ret;
>
> - ret = media_create_pad_link(
> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
> - &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
> + ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
> + &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
> if (ret < 0)
> return ret;
>
> - ret = media_create_pad_link(
> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
> - &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
> + ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
> + &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
> if (ret < 0)
> return ret;
>
> - ret = media_create_pad_link(
> - &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
> - &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
> + ret = media_create_pad_link(&iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
> + &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
> if (ret < 0)
> return ret;
>
>
These, however, are readability improvements, so I'm happy with that.
Regards,
Hans
Em 07/04/21 14:46, Hans Verkuil escreveu:
> Hi Beatriz,
Hi,
>
> I'm now reviewing staging/media patches instead of Greg KH. See Vaishali's
> email from today: "Sending patches for the drivers/staging/media".
Yes, I saw the email! Thanks for helping us!
>
> On 01/04/2021 17:07, Beatriz Martins de Carvalho wrote:
>> Remove checkpatch check "CHECK: Lines should not end with a '('" with
>> argument present in next line and reorganize characters so the lines
>> are under 100 columns
>>
>> Signed-off-by: Beatriz Martins de Carvalho <[email protected]>
>> ---
>> drivers/staging/media/omap4iss/iss.c | 46 +++++++++++++---------------
>> 1 file changed, 22 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
>> index dae9073e7d3c..e8f724dbf810 100644
>> --- a/drivers/staging/media/omap4iss/iss.c
>> +++ b/drivers/staging/media/omap4iss/iss.c
>> @@ -559,9 +559,10 @@ static int iss_reset(struct iss_device *iss)
>> iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG,
>> ISS_HL_SYSCONFIG_SOFTRESET);
>>
>> - timeout = iss_poll_condition_timeout(
>> - !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) &
>> - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100);
>> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss,
>> + OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG)
>> + & ISS_HL_SYSCONFIG_SOFTRESET),
>> + 1000, 10, 100);
>> if (timeout) {
>> dev_err(iss->dev, "ISS reset timeout\n");
>> return -ETIMEDOUT;
>> @@ -583,9 +584,10 @@ static int iss_isp_reset(struct iss_device *iss)
>>
>> iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, ISP5_CTRL_MSTANDBY);
>>
>> - timeout = iss_poll_condition_timeout(
>> - iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) &
>> - ISP5_CTRL_MSTANDBY_WAIT, 1000000, 1000, 1500);
>> + timeout = iss_poll_condition_timeout(iss_reg_read(iss,
>> + OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL)
>> + & ISP5_CTRL_MSTANDBY_WAIT, 1000000,
>> + 1000, 1500);
>> if (timeout) {
>> dev_err(iss->dev, "ISP5 standby timeout\n");
>> return -ETIMEDOUT;
>> @@ -595,9 +597,10 @@ static int iss_isp_reset(struct iss_device *iss)
>> iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG,
>> ISP5_SYSCONFIG_SOFTRESET);
>>
>> - timeout = iss_poll_condition_timeout(
>> - !(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) &
>> - ISP5_SYSCONFIG_SOFTRESET), 1000000, 1000, 1500);
>> + timeout = iss_poll_condition_timeout(!(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1,
>> + ISP5_SYSCONFIG) &
>> + ISP5_SYSCONFIG_SOFTRESET), 1000000,
>> + 1000, 1500);
> As several other people already commented, these changes do not improve readability.
> Just leave this code alone, it's good enough. Even splitting up the condition into
> a separate function would degrade readability since that would make it harder to
> discover the exact condition that will be polled for.
>
> Not everything that checkpatch.pl flags is necessarily bad code :-)
Yes, I learning about this. And I will using this for the next patches.
>
>> if (timeout) {
>> dev_err(iss->dev, "ISP5 reset timeout\n");
>> return -ETIMEDOUT;
>> @@ -1104,33 +1107,28 @@ static int iss_create_links(struct iss_device *iss)
>> }
>>
>> /* Connect the submodules. */
>> - ret = media_create_pad_link(
>> - &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
>> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
>> + ret = media_create_pad_link(&iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
>> + &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
>> if (ret < 0)
>> return ret;
>>
>> - ret = media_create_pad_link(
>> - &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
>> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
>> + ret = media_create_pad_link(&iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
>> + &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
>> if (ret < 0)
>> return ret;
>>
>> - ret = media_create_pad_link(
>> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
>> - &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
>> + ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
>> + &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
>> if (ret < 0)
>> return ret;
>>
>> - ret = media_create_pad_link(
>> - &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
>> - &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
>> + ret = media_create_pad_link(&iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
>> + &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
>> if (ret < 0)
>> return ret;
>>
>> - ret = media_create_pad_link(
>> - &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
>> - &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
>> + ret = media_create_pad_link(&iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
>> + &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
>> if (ret < 0)
>> return ret;
>>
>>
> These, however, are readability improvements, so I'm happy with that.
Thank!
>
> Regards,
>
> Hans
Best wishes,
Beatriz Carvalho