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

Aneesh Kumar K.V
2025-10-30T14:05:00Z

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);

guard(mutex)(&pf0_dsc->object_lock);
state = do_pdev_communicate(tsm, setup_work->target_state);

>> +
>> + guard(mutex)(&pf0_dsc->object_lock);
>> + state = do_pdev_communicate(tsm, setup_work->target_state);
>> + WARN_ON(state != setup_work->target_state);
>> +
>> + complete(&setup_work->complete);
>> +}
>

-aneesh