All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Binbin Zhou <zhoubb.aaron@gmail.com>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>,
	Huacai Chen <chenhuacai@loongson.cn>,
	Corey Minyard <minyard@acm.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	Xuerui Wang <kernel@xen0n.name>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	openipmi-developer@lists.sourceforge.net, jeffbai@aosc.io,
	kexybiscuit@aosc.io, wangyao@lemote.com,
	Chong Qiao <qiaochong@loongson.cn>,
	Corey Minyard <corey@minyard.net>
Subject: Re: [PATCH v7 1/3] mfd: ls2kbmc: Introduce Loongson-2K BMC core driver
Date: Fri, 18 Jul 2025 15:02:06 +0100	[thread overview]
Message-ID: <20250718140206.GI11056@google.com> (raw)
In-Reply-To: <CAMpQs4JccEmMAguB92jQriwD65Ra+hQKMZnjAsWhNOKhN_Om7A@mail.gmail.com>

On Fri, 11 Jul 2025, Binbin Zhou wrote:

> Hi Lee:
> 
> Thanks for your review.
> 
> On Thu, Jul 10, 2025 at 5:56 PM Lee Jones <lee@kernel.org> wrote:
> >
> > On Fri, 04 Jul 2025, Binbin Zhou wrote:
> >
> > > The Loongson-2K Board Management Controller provides an PCIe interface
> > > to the host to access the feature implemented in the BMC.
> > >
> > > The BMC is assembled on a server similar to the server machine with
> > > Loongson-3 CPU. It supports multiple sub-devices like DRM and IPMI.
> > >
> > > Co-developed-by: Chong Qiao <qiaochong@loongson.cn>
> > > Signed-off-by: Chong Qiao <qiaochong@loongson.cn>
> > > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> > > Acked-by: Corey Minyard <corey@minyard.net>
> > > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > > ---
> > >  MAINTAINERS                 |   6 ++
> > >  drivers/mfd/Kconfig         |  13 +++
> > >  drivers/mfd/Makefile        |   2 +
> > >  drivers/mfd/ls2k-bmc-core.c | 156 ++++++++++++++++++++++++++++++++++++
> > >  4 files changed, 177 insertions(+)

[...]

> > > +static int ls2k_bmc_probe(struct pci_dev *dev, const struct pci_device_id *id)
> > > +{
> > > +     struct simplefb_platform_data pd;
> > > +     resource_size_t base;
> > > +     int ret;
> > > +
> > > +     ret = pci_enable_device(dev);
> > > +     if (ret)
> > > +             return ret;
> > > +
> > > +     ret = ls2k_bmc_parse_mode(dev, &pd);
> > > +     if (ret)
> > > +             goto disable_pci;
> > > +
> > > +     ls2k_bmc_cells[0].platform_data = &pd;
> > > +     ls2k_bmc_cells[0].pdata_size = sizeof(pd);
> >
> > This is fragile.
> >
> > Please identify the elements in ls2k_bmc_cells and use it to index here.
> >
> > See: `static struct mfd_cell as3711_subdevs`
> 
> How about this:
> 
> enum {
>         LS2K_BMC_DISPLAY,
>         LS2k_BMC_IPMI0,
>         LS2k_BMC_IPMI1,
>         LS2k_BMC_IPMI2,
>         LS2k_BMC_IPMI3,
>         LS2k_BMC_IPMI4,
> };
> 
> static struct mfd_cell ls2k_bmc_cells[] = {
>         [LS2K_BMC_DISPLAY] = {
>                 .name = "simple-framebuffer",
>                 .num_resources = ARRAY_SIZE(ls2k_display_resources),
>                 .resources = ls2k_display_resources
>         },
>         [LS2k_BMC_IPMI0] = {
>                 .name = "ls2k-ipmi-si",
>                 .num_resources = ARRAY_SIZE(ls2k_ipmi0_resources),
>                 .resources = ls2k_ipmi0_resources
>         },
>         [LS2k_BMC_IPMI1] = {
>                 .name = "ls2k-ipmi-si",
>                 .num_resources = ARRAY_SIZE(ls2k_ipmi1_resources),
>                 .resources = ls2k_ipmi1_resources
>         },
>         [LS2k_BMC_IPMI2] = {
>                 .name = "ls2k-ipmi-si",
>                 .num_resources = ARRAY_SIZE(ls2k_ipmi2_resources),
>                 .resources = ls2k_ipmi2_resources
>         },
>         [LS2k_BMC_IPMI3] = {
>                 .name = "ls2k-ipmi-si",
>                 .num_resources = ARRAY_SIZE(ls2k_ipmi3_resources),
>                 .resources = ls2k_ipmi3_resources
>         },
>         [LS2k_BMC_IPMI4] = {
>                 .name = "ls2k-ipmi-si",
>                 .num_resources = ARRAY_SIZE(ls2k_ipmi4_resources),
>                 .resources = ls2k_ipmi4_resources
>         },
> };
> 
> and
> 
>         ls2k_bmc_cells[LS2K_BMC_DISPLAY].platform_data = &pd;
>         ls2k_bmc_cells[LS2K_BMC_DISPLAY].pdata_size = sizeof(pd);

Yes, that's it.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2025-07-18 14:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04  9:21 [PATCH v7 0/3] LoongArch: Add Loongson-2K BMC support Binbin Zhou
2025-07-04  9:21 ` [PATCH v7 1/3] mfd: ls2kbmc: Introduce Loongson-2K BMC core driver Binbin Zhou
2025-07-10  9:56   ` Lee Jones
2025-07-11  7:17     ` Binbin Zhou
2025-07-18 14:02       ` Lee Jones [this message]
2025-07-04  9:21 ` [PATCH v7 2/3] mfd: ls2kbmc: Add Loongson-2K BMC reset function support Binbin Zhou
2025-07-10 10:03   ` Lee Jones
2025-07-11  7:24     ` Binbin Zhou
2025-07-18 13:52       ` Lee Jones
2025-07-21  2:26         ` Binbin Zhou
2025-07-23  7:31           ` Lee Jones
2025-07-23  8:02             ` Binbin Zhou
2025-07-23  8:21               ` Lee Jones
2025-07-23  8:44                 ` Binbin Zhou
2025-07-04  9:21 ` [PATCH v7 3/3] ipmi: Add Loongson-2K BMC support Binbin Zhou

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=20250718140206.GI11056@google.com \
    --to=lee@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=corey@minyard.net \
    --cc=jeffbai@aosc.io \
    --cc=kernel@xen0n.name \
    --cc=kexybiscuit@aosc.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=qiaochong@loongson.cn \
    --cc=wangyao@lemote.com \
    --cc=zhoubb.aaron@gmail.com \
    --cc=zhoubinbin@loongson.cn \
    /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.