From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org,
Jens Wiklander <jens.wiklander@linaro.org>
Subject: Re: [PATCH] tee: make tee_class constant
Date: Mon, 9 Oct 2023 12:13:21 +0200 [thread overview]
Message-ID: <2023100952-yapping-rockiness-f1e3@gregkh> (raw)
In-Reply-To: <CAFA6WYNbMsEE7OF0SpLN5gQx5-TNPXD7Zm+2tVu21xdpzKU=Xg@mail.gmail.com>
On Mon, Oct 09, 2023 at 11:04:33AM +0530, Sumit Garg wrote:
> On Fri, 6 Oct 2023 at 19:30, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > Now that the driver core allows for struct class to be in read-only
> > memory, we should make all 'class' structures declared at build time
> > placing them into read-only memory, instead of having to be dynamically
> > allocated at runtime.
> >
> > Cc: Jens Wiklander <jens.wiklander@linaro.org>
> > Cc: Sumit Garg <sumit.garg@linaro.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > drivers/tee/tee_core.c | 21 +++++++++++----------
> > 1 file changed, 11 insertions(+), 10 deletions(-)
> >
>
> Apart from nit below, feel free to add:
>
> Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
>
> > diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> > index 0eb342de0b00..5ddfd5d9ac7f 100644
> > --- a/drivers/tee/tee_core.c
> > +++ b/drivers/tee/tee_core.c
> > @@ -40,7 +40,10 @@ static const uuid_t tee_client_uuid_ns = UUID_INIT(0x58ac9ca0, 0x2086, 0x4683,
> > static DECLARE_BITMAP(dev_mask, TEE_NUM_DEVICES);
> > static DEFINE_SPINLOCK(driver_lock);
> >
> > -static struct class *tee_class;
> > +static const struct class tee_class = {
> > + .name = "tee",
> > +};
> > +
> > static dev_t tee_devt;
> >
> > struct tee_context *teedev_open(struct tee_device *teedev)
> > @@ -919,7 +922,7 @@ struct tee_device *tee_device_alloc(const struct tee_desc *teedesc,
> > teedesc->flags & TEE_DESC_PRIVILEGED ? "priv" : "",
> > teedev->id - offs);
> >
> > - teedev->dev.class = tee_class;
> > + teedev->dev.class = &tee_class;
> > teedev->dev.release = tee_release_device;
> > teedev->dev.parent = dev;
> >
> > @@ -1112,7 +1115,7 @@ tee_client_open_context(struct tee_context *start,
> > dev = &start->teedev->dev;
> >
> > do {
> > - dev = class_find_device(tee_class, dev, &match_data, match_dev);
> > + dev = class_find_device(&tee_class, dev, &match_data, match_dev);
> > if (!dev) {
> > ctx = ERR_PTR(-ENOENT);
> > break;
> > @@ -1226,10 +1229,10 @@ static int __init tee_init(void)
> > {
> > int rc;
> >
> > - tee_class = class_create("tee");
> > - if (IS_ERR(tee_class)) {
> > + rc = class_register(&tee_class);
> > + if (rc) {
> > pr_err("couldn't create class\n");
>
> nit: this error message should be updated as well.
Ah, missed that, thanks! Will send a follow-up patch for that.
greg k-h
prev parent reply other threads:[~2023-10-09 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 14:00 Greg Kroah-Hartman
2023-10-09 5:34 ` Sumit Garg
2023-10-09 10:13 ` Greg Kroah-Hartman [this message]
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=2023100952-yapping-rockiness-f1e3@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jens.wiklander@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=sumit.garg@linaro.org \
/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 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®