Re: [PATCH v6] mm: cma: support sysfs

From: John Hubbard
Date: Wed Mar 24 2021 - 03:12:06 EST


On 3/23/21 11:57 PM, Minchan Kim wrote:
...
, how about approximately this:

struct cma_kobject_wrapper {
struct cma *parent;
struct kobject kobj;
};

struct cma {
...
struct cma_kobject_wrapper *cma_kobj_wrapper;
};


...thus allowing readers of cma_sysfs.c to read that file more easily.

I agree cma->kobj->kobj is awkward but personally, I don't like the
naming: cma_kobject_wrapper parent pointer. cma_kobject is alredy
wrapper so it sounds me redundant and it's not a parent in same
hierarchy.

Since the kobj->kobj is just one line in the code(I don't imagine
it could grow up in cma_sysfs in future), I don't think it would
be a problem. If we really want to make it more clear, maybe?

cma->cma_kobj->kobj

It would be consistent with other variables in cma_sysfs_init.


OK, that's at least better than it was.

thanks,
--
John Hubbard
NVIDIA