mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommu: use iommu_group_ref_get to hold group reference
@ 2022-08-26  2:40 Yuan Can
  2022-08-30  9:32 ` Robin Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Yuan Can @ 2022-08-26  2:40 UTC (permalink / raw)
  To: joro, will, robin.murphy, iommu
  Cc: linux-kernel, yuancan, baolu.lu, haifeng.zhao

Replace kobject_get with iommu_group_ref_get for better
readability.

Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 780fb7071577..8e7f30f7188c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -903,7 +903,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
 		goto err_free_name;
 	}
 
-	kobject_get(group->devices_kobj);
+	iommu_group_ref_get(group);
 
 	dev->iommu_group = group;
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: use iommu_group_ref_get to hold group reference
  2022-08-26  2:40 [PATCH] iommu: use iommu_group_ref_get to hold group reference Yuan Can
@ 2022-08-30  9:32 ` Robin Murphy
  2022-08-30 12:57   ` Yuan Can
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Murphy @ 2022-08-30  9:32 UTC (permalink / raw)
  To: Yuan Can, joro, will, iommu; +Cc: linux-kernel, baolu.lu, haifeng.zhao

On 2022-08-26 03:40, Yuan Can wrote:
> Replace kobject_get with iommu_group_ref_get for better
> readability.

I disagree, sorry. iommu_group_ref_get() is meant as a helper for 
drivers, and the core code uses the raw kobject internally everywhere 
else, including several other times within this function. Especially the 
raw kobject_put() in the cleanup path - in terms of readability I'd say 
it's actively harmful to obfuscate what that pairs with.

Thanks,
Robin.

> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>   drivers/iommu/iommu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 780fb7071577..8e7f30f7188c 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -903,7 +903,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
>   		goto err_free_name;
>   	}
>   
> -	kobject_get(group->devices_kobj);
> +	iommu_group_ref_get(group);
>   
>   	dev->iommu_group = group;
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: use iommu_group_ref_get to hold group reference
  2022-08-30  9:32 ` Robin Murphy
@ 2022-08-30 12:57   ` Yuan Can
  0 siblings, 0 replies; 3+ messages in thread
From: Yuan Can @ 2022-08-30 12:57 UTC (permalink / raw)
  To: Robin Murphy, joro, will, iommu; +Cc: linux-kernel, baolu.lu, haifeng.zhao


在 2022/8/30 17:32, Robin Murphy 写道:
> On 2022-08-26 03:40, Yuan Can wrote:
>> Replace kobject_get with iommu_group_ref_get for better
>> readability.
>
> I disagree, sorry. iommu_group_ref_get() is meant as a helper for 
> drivers, and the core code uses the raw kobject internally everywhere 
> else, including several other times within this function. Especially 
> the raw kobject_put() in the cleanup path - in terms of readability 
> I'd say it's actively harmful to obfuscate what that pairs with.
>
> Thanks,
> Robin.

Understood, thanks for your reply.

Best regards,

Yuan Can

>
>> Signed-off-by: Yuan Can <yuancan@huawei.com>
>> ---
>>   drivers/iommu/iommu.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
>> index 780fb7071577..8e7f30f7188c 100644
>> --- a/drivers/iommu/iommu.c
>> +++ b/drivers/iommu/iommu.c
>> @@ -903,7 +903,7 @@ int iommu_group_add_device(struct iommu_group 
>> *group, struct device *dev)
>>           goto err_free_name;
>>       }
>>   -    kobject_get(group->devices_kobj);
>> +    iommu_group_ref_get(group);
>>         dev->iommu_group = group;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-30 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  2:40 [PATCH] iommu: use iommu_group_ref_get to hold group reference Yuan Can
2022-08-30  9:32 ` Robin Murphy
2022-08-30 12:57   ` Yuan Can

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®