Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1793210rdb; Mon, 9 Oct 2023 03:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh+4R4/Zl+acVE0Tp52YxouZ0043lxy4KL50o/Ol353QzCAHUYGuqVoWsz/VSFhf7NzqeC X-Received: by 2002:a05:6a00:391b:b0:691:21:d9b1 with SMTP id fh27-20020a056a00391b00b006910021d9b1mr13972085pfb.31.1696846421850; Mon, 09 Oct 2023 03:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696846421; cv=none; d=google.com; s=arc-20160816; b=D6MuEsR584O33RpYHU5f3I1KswiTpukBIONgy/VU/F1VBPBkPEXafMN0d/nVNGLWfD ou3rCJ34mfTJBpsfRexcyyOmLYZ6xpKP9CK2b85yzgJ358yKf0TxdGMY7fEdNjQLisoO wvZeB3U10zqXMAHXrKuH22eR5GQxFttMwRELDRA2Kj59URihhenRhh1i9nHtH8y6n8zQ TxoJV67l3Wl4rXIFPq7X/nXmyFjwUOHiPWbPqD16kCC7FdjhL0MInmoXTN5ud9JZL/Jx TdWUnoUVIurt625z4nqjTHuTzDxIXnXIwGZg9m9pP285JbdT1pUcpECvx5RcB3+lryc/ IKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Rl4BluiFMUGLbyLJxM6P1ti5R9ggdKJUsBsO8Ei9YHc=; fh=J9K2vtu2wFgUsPbwYbjGZjF6XfobPIGM5uHwDkzOPcg=; b=GBscpXSje/PxsWmoiPEa4UtEAwI474aWyJXujpMNTAd4E343MJ2grk8HGpCwfE3x/t SZPM2fYk/QJb8xhU5gBqFPCqP4XXBUAbnm9meuacdTusLdhgZF8UwTOrU8hGyCE/FnWY cDmpEcQFobD/gXYp2ENOPeTW0qN7N5+Qw8xUASx9AQ3BaNuU1mPCrPl6HDtuBW3l2b+y PkcNZkNGJ7b7NAp94H8skM6lsZ+HPxXPrsJGF2VdoonHMjoQ/Z40xMz0OifYsieTTKiq K0BjsKL78NCclK04o86FcdhZzOlJSqV/ejARP+GOe1sA8e5IQJI8ZdsdZWb5vNMyQxze 0v9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zGWbOp4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id c10-20020a056a00248a00b0068ffda29587si7389647pfv.109.2023.10.09.03.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 03:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zGWbOp4L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B92B9809E208; Mon, 9 Oct 2023 03:13:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346126AbjJIKN1 (ORCPT + 99 others); Mon, 9 Oct 2023 06:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346124AbjJIKN0 (ORCPT ); Mon, 9 Oct 2023 06:13:26 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D6B9AB for ; Mon, 9 Oct 2023 03:13:23 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96312C433C7; Mon, 9 Oct 2023 10:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696846403; bh=YfNHX7fOB23fzO4vlatr2RpIOyGVl9c/BlM3RYmxUM0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zGWbOp4LMq2AOqyx8nvBJlRVXSrYX1alxYqDB91I7RieM5AMKmxjbZUBTBa1ftxlJ LcD9S5f7WlyNl5tiag2LOvW7MSBrXq2P6sao/q4PnxKlAvjbiXwCq/0PRsok2hjQiA kp3zvHLhD3O8ofKdIV91NEFLPPhCSwGy4lvsqzEY= Date: Mon, 9 Oct 2023 12:13:21 +0200 From: Greg Kroah-Hartman To: Sumit Garg Cc: op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, Jens Wiklander Subject: Re: [PATCH] tee: make tee_class constant Message-ID: <2023100952-yapping-rockiness-f1e3@gregkh> References: <2023100613-lustiness-affiliate-7dcb@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 03:13:38 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 11:04:33AM +0530, Sumit Garg wrote: > On Fri, 6 Oct 2023 at 19:30, Greg Kroah-Hartman > 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 > > Cc: Sumit Garg > > Signed-off-by: Greg Kroah-Hartman > > --- > > 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 > > > 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