From: Greg KH <gregkh@linuxfoundation.org>
To: himanshu bakshi <himanshu.bakshi478@gmail.com>
Cc: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com,
linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: sm750fb: Simplify M2XCLK divisor encoding
Date: Fri, 23 Oct 2026 15:36:18 +0200 [thread overview]
Message-ID: <2026102332-siberian-escapist-cf1c@gregkh> (raw)
In-Reply-To: <20261018092651.49924-1-himanshu.bakshi478@gmail.com>
On Sun, Oct 18, 2026 at 02:56:51PM +0530, himanshu bakshi wrote:
> Replace the switch statement with a macro to encode the M2XCLK
> divisor in the corresponding register bits.
Why?
> This is my first Linux kernel patch.
Great, but that doesn't need to be in the changelog :)
> Signed-off-by: himanshu bakshi <himanshu.bakshi478@gmail.com>
Capital letters please.
> ---
> drivers/staging/sm750fb/ddk750_chip.c | 18 +++---------------
> drivers/staging/sm750fb/ddk750_reg.h | 5 +----
> 2 files changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
> index aa78d0bc1..2cb849dea 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -109,21 +109,9 @@ static void set_memory_clock(unsigned int frequency)
>
> /* Set the corresponding divisor in the register. */
> reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
> - switch (divisor) {
> - default:
> - case 1:
> - reg |= CURRENT_GATE_M2XCLK_DIV_1;
> - break;
> - case 2:
> - reg |= CURRENT_GATE_M2XCLK_DIV_2;
> - break;
> - case 3:
> - reg |= CURRENT_GATE_M2XCLK_DIV_3;
> - break;
> - case 4:
> - reg |= CURRENT_GATE_M2XCLK_DIV_4;
> - break;
> - }
> + if (divisor == 0 || divisor > 4)
> + divisor = 1;
> + reg |= CURRENT_GATE_M2XCLK_DIV(divisor);
>
> sm750_set_current_gate(reg);
> }
> diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
> index fe412ead7..b796e32ab 100644
> --- a/drivers/staging/sm750fb/ddk750_reg.h
> +++ b/drivers/staging/sm750fb/ddk750_reg.h
> @@ -312,10 +312,7 @@
> #define CURRENT_GATE_M2XCLK_112MHZ (0x2 << 12)
> #define CURRENT_GATE_M2XCLK_84MHZ (0x3 << 12)
> #else
> - #define CURRENT_GATE_M2XCLK_DIV_1 (0x0 << 12)
> - #define CURRENT_GATE_M2XCLK_DIV_2 (0x1 << 12)
> - #define CURRENT_GATE_M2XCLK_DIV_3 (0x2 << 12)
> - #define CURRENT_GATE_M2XCLK_DIV_4 (0x3 << 12)
> + #define CURRENT_GATE_M2XCLK_DIV(divisor) (((divisor) - 1) << 12)
The original is more descriptive of the hardware data sheet, right?
thanks,
greg k-h
prev parent reply other threads:[~2026-10-23 15:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 9:26 himanshu bakshi
2026-10-23 13:36 ` Greg KH [this message]
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=2026102332-siberian-escapist-cf1c@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=himanshu.bakshi478@gmail.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=sudipm.mukherjee@gmail.com \
--cc=teddy.wang@siliconmotion.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®