Re: [PATCH RESEND v2 06/12] coco: host: arm64: Add RMM device communication helpers

Jonathan Cameron
2025-10-30T18:02:58Z

On Thu, 30 Oct 2025 19:34:51 +0530
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org> wrote:

> Jonathan Cameron <jonathan.cameron@huawei.com> writes:
>
> > On Mon, 27 Oct 2025 15:25:56 +0530
> > "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org> wrote:
> >
>
> ...
>
> >> +void pdev_communicate_work(struct work_struct *work)
> >> +{
> >> + unsigned long state;
> >> + struct pci_tsm *tsm;
> >> + struct dev_comm_work *setup_work;
> >> + struct cca_host_pf0_dsc *pf0_dsc;
> >> +
> >> + setup_work = container_of(work, struct dev_comm_work, work);
> >> + tsm = setup_work->tsm;
> >> + pf0_dsc = to_cca_pf0_dsc(tsm->dsm_dev);
> > Could combine these 3 with declarations for shorter code without much
> > change to readability.
> >
>
> Not sure about this.
>
> static void pdev_communicate_work(struct work_struct *work)
> {
> unsigned long state;
> - struct pci_tsm *tsm;
> - struct dev_comm_work *setup_work;
> - struct cca_host_pf0_dsc *pf0_dsc;
> -
> - setup_work = container_of(work, struct dev_comm_work, work);
> - tsm = setup_work->tsm;
> - pf0_dsc = to_cca_pf0_dsc(tsm->dsm_dev);
> + struct dev_comm_work *setup_work = container_of(work,
> + struct dev_comm_work,
> + work);
> + struct pci_tsm *tsm = setup_work->tsm;
> + struct cca_host_pf0_dsc *pf0_dsc = to_cca_pf0_dsc(tsm->dsm_dev);
I'd wrap it a bit differently.

struct dev_comm_work *setup_work =
container_of(work, struct dev_comm_work, work);
struct pci_tsm *tsm = setup_work->tsm;
struct cca_host_pf0_dsc *pf0_dsc = to_cca_pf0_dsc(tsm->dsm_dev);

Entirely up to you. Hence the could part of the comment.

Jonathan