Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp589042lqc; Fri, 8 Mar 2024 06:31:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWEVqnnjSy/5iPtHBXfBsAy2VcBup3XJDXXTcLziIxKYfC3iLeH7mofhXe+GGOaWi3BmF1ya9u1HdWW7epaPFM2hA+FGqGfgBubYUrCnA== X-Google-Smtp-Source: AGHT+IF1xYz95Vw5rrVu8j4d8RM1XnElPwZWxcgQran4vizzQ1FdSjGi/ok5FdFcswsYYupDT1JE X-Received: by 2002:a9d:6a19:0:b0:6e4:dff7:75dd with SMTP id g25-20020a9d6a19000000b006e4dff775ddmr11299645otn.17.1709908304124; Fri, 08 Mar 2024 06:31:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709908304; cv=pass; d=google.com; s=arc-20160816; b=J2T1Z+CM65UejCJV/esswv+oKtiOtVfCZeABpe3q1IacSMJf1pgjnwSOsqHa9s1j5d zLR7afW6XNFKlZI52m8CZVSf00ucmec6jIi2AbV4O/BBpqD+xL2BKg+mKqvX3nbjWL9W 3RIJx7IlyaSApQKiuyl8ghdGXGjvSyHuZiD/kNaKd9oz43xuer6M4RjvTGAsuGUnaxjq 1headZa1Yxjy1yVmIPYZ0vQJ64H3vTaPK/F9UYhqBOpcUiQcrM+7lt+7HztnNCZrW/Da J/R+GcTyU2txxdWAEPNqpM/21MgXiigi2IGhbIyD465XUoK5UNO639ywMXrHsaohzpuv Cn5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:message-id:references:in-reply-to :mail-reply-to:reply-to:subject:cc:to:from:date:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:dkim-signature; bh=GvExlI5QRvQGi2jlPYy9ptuyzGEchZAeDh1QtaQuKR8=; fh=+xBeDR8CSKwuOIdXCIRCypsPg0SE2v6jwSahznxTEq0=; b=L22Dvn2DM6ZeEaHRZKCrdWXgBv649Hw7/eDIffKx7i8iTHaFP7f587Ele2IKT0zR2I rifiND7yLpnesWDMeiC/gpa2mmcAr78wkEHK3KZmOeT6trXaonzXG9a/wP6iAG1MSL6E sF+rOY5wkoOgpfWtPuGtlFlzukUgCcFhWSxcRXX90VfZnjyNpaE3oPhwZwq0IlAk73WL UIa52MKKdkcdhtVTAF8elP/bbzT0/27AuZs0IK8ebAEr6tAXNGSQNi9Fhzbsf+PwOUkb I1SXqV54qYZGdEBWbqa3b3hetE7TQfOR5hOLxnWPfYQRWiO9i+kn0VbcH7gFEy6SLi1H +XIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aDpakm7D; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-97160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z19-20020a63c053000000b005dcbda499c9si15883495pgi.261.2024.03.08.06.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 06:31:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aDpakm7D; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-97160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4D8A3B245AD for ; Fri, 8 Mar 2024 14:22:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29E715E3A5; Fri, 8 Mar 2024 14:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="aDpakm7D" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B2D65E09A; Fri, 8 Mar 2024 14:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709907572; cv=none; b=b9KpHn5v62ywRWJ06QGSxsEY0D+toT6gr0WAOkE8jYKxl153qP6DS1nkAIcdKBhKoBGtbXSqq1g45SEsSupMkh80eFE+PJ6f6CH9Gj446Ssm/P7WP6mwclD8ObHJIldsfSLZJpnDTwlz1hIN8zrIwY5OyPBIlTMbrI+id2cMNx0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709907572; c=relaxed/simple; bh=kOYxEEaMHOVfx0vX9WR0taTB0+emJnmrpE5HjLADvco=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=go+73bVDoIDTgvsdOeILYsl0lfS7S7glFBr5sQ1iRlBJSUUqMRtg3jtrbmZQbJx4QmLpqZnM7DROwttyxmksMdadeBzgnQ+rWowxCT0L6enGNM59GA3ZNXrL1JvMC13KnRA0LObFTaSHILQdwi4obKqbtDPZ65saVeJus4ZNOqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=aDpakm7D; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 428Dv11h009389; Fri, 8 Mar 2024 14:19:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=mime-version : date : from : to : cc : subject : reply-to : in-reply-to : references : message-id : content-type : content-transfer-encoding; s=pp1; bh=GvExlI5QRvQGi2jlPYy9ptuyzGEchZAeDh1QtaQuKR8=; b=aDpakm7DgD+zRFXCTsibSx+cUjRcpgVcQBuxDmfqCi3xMIRbmojqsQT9/7UlXON0aFY2 4YepqQaCX58HcaFvCkpK22BxSZfZyE6i7r711cTNCFzn902w0+RvhI9oG0IsUZ8VLICz Xc9eDYtx0c9lpaB/XLlMyj5yUa2qPTgSQ3EVMtIfNmVy82l3M1/N9t0QOUAZEw6CndVP mne6ACLyM2zMeRTPLWpZ5nxNaij7CcieEHxprmiqxiBPEfplZwK610LuTjPjglPLPo3C +m4KVM5u5yaLXx2sDC4pefSPcIkA3g9FIRhPGwe3wD7SqjEWWisaK1okpc3F369fP1xm hw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wr40r0bhc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 14:19:19 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 428DZCW9010881; Fri, 8 Mar 2024 14:19:19 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wmh52vd0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 14:19:19 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 428EJFb439780666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Mar 2024 14:19:17 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5313858061; Fri, 8 Mar 2024 14:19:15 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDB655803F; Fri, 8 Mar 2024 14:19:14 +0000 (GMT) Received: from ltc.linux.ibm.com (unknown [9.5.196.140]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 8 Mar 2024 14:19:14 +0000 (GMT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Fri, 08 Mar 2024 15:19:14 +0100 From: Harald Freudenberger To: "Ricardo B. Marliere" , Heiko Carstens , Vasily Gorbik Cc: Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH 1/6] s390: zcrypt: make zcrypt_class constant Reply-To: freude@linux.ibm.com Mail-Reply-To: freude@linux.ibm.com In-Reply-To: <20240305-class_cleanup-s390-v1-1-c4ff1ec49ffd@marliere.net> References: <20240305-class_cleanup-s390-v1-0-c4ff1ec49ffd@marliere.net> <20240305-class_cleanup-s390-v1-1-c4ff1ec49ffd@marliere.net> Message-ID: <84263def1d38584cd83558a33bb52f22@linux.ibm.com> X-Sender: freude@linux.ibm.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9WJtshnj7cPM-7fJM6NVdOkIhjZ1COWE X-Proofpoint-GUID: 9WJtshnj7cPM-7fJM6NVdOkIhjZ1COWE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1011 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403080114 On 2024-03-05 12:25, Ricardo B. Marliere wrote: > Since commit 43a7206b0963 ("driver core: class: make class_register() > take > a const *"), the driver core allows for struct class to be in read-only > memory, so move the zcrypt_class structure to be declared at build time > placing it into read-only memory, instead of having to be dynamically > allocated at boot time. > > Cc: Greg Kroah-Hartman > Suggested-by: Greg Kroah-Hartman > Signed-off-by: Ricardo B. Marliere > --- > drivers/s390/crypto/zcrypt_api.c | 33 > +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/s390/crypto/zcrypt_api.c > b/drivers/s390/crypto/zcrypt_api.c > index e8742757085b..d0358bb6ccf2 100644 > --- a/drivers/s390/crypto/zcrypt_api.c > +++ b/drivers/s390/crypto/zcrypt_api.c > @@ -116,7 +116,11 @@ EXPORT_SYMBOL(zcrypt_msgtype); > > struct zcdn_device; > > -static struct class *zcrypt_class; > +static void zcdn_device_release(struct device *dev); > +static const struct class zcrypt_class = { > + .name = ZCRYPT_NAME, > + .dev_release = zcdn_device_release, > +}; > static dev_t zcrypt_devt; > static struct cdev zcrypt_cdev; > > @@ -139,7 +143,7 @@ static int zcdn_destroy(const char *name); > */ > static inline struct zcdn_device *find_zcdndev_by_name(const char > *name) > { > - struct device *dev = class_find_device_by_name(zcrypt_class, name); > + struct device *dev = class_find_device_by_name(&zcrypt_class, name); > > return dev ? to_zcdn_dev(dev) : NULL; > } > @@ -151,7 +155,7 @@ static inline struct zcdn_device > *find_zcdndev_by_name(const char *name) > */ > static inline struct zcdn_device *find_zcdndev_by_devt(dev_t devt) > { > - struct device *dev = class_find_device_by_devt(zcrypt_class, devt); > + struct device *dev = class_find_device_by_devt(&zcrypt_class, devt); > > return dev ? to_zcdn_dev(dev) : NULL; > } > @@ -405,7 +409,7 @@ static int zcdn_create(const char *name) > goto unlockout; > } > zcdndev->device.release = zcdn_device_release; > - zcdndev->device.class = zcrypt_class; > + zcdndev->device.class = &zcrypt_class; > zcdndev->device.devt = devt; > zcdndev->device.groups = zcdn_dev_attr_groups; > if (name[0]) > @@ -2067,12 +2071,9 @@ static int __init zcdn_init(void) > int rc; > > /* create a new class 'zcrypt' */ > - zcrypt_class = class_create(ZCRYPT_NAME); > - if (IS_ERR(zcrypt_class)) { > - rc = PTR_ERR(zcrypt_class); > + rc = class_register(&zcrypt_class); > + if (rc) > goto out_class_create_failed; > - } > - zcrypt_class->dev_release = zcdn_device_release; > > /* alloc device minor range */ > rc = alloc_chrdev_region(&zcrypt_devt, > @@ -2088,35 +2089,35 @@ static int __init zcdn_init(void) > goto out_cdev_add_failed; > > /* need some class specific sysfs attributes */ > - rc = class_create_file(zcrypt_class, &class_attr_zcdn_create); > + rc = class_create_file(&zcrypt_class, &class_attr_zcdn_create); > if (rc) > goto out_class_create_file_1_failed; > - rc = class_create_file(zcrypt_class, &class_attr_zcdn_destroy); > + rc = class_create_file(&zcrypt_class, &class_attr_zcdn_destroy); > if (rc) > goto out_class_create_file_2_failed; > > return 0; > > out_class_create_file_2_failed: > - class_remove_file(zcrypt_class, &class_attr_zcdn_create); > + class_remove_file(&zcrypt_class, &class_attr_zcdn_create); > out_class_create_file_1_failed: > cdev_del(&zcrypt_cdev); > out_cdev_add_failed: > unregister_chrdev_region(zcrypt_devt, ZCRYPT_MAX_MINOR_NODES); > out_alloc_chrdev_failed: > - class_destroy(zcrypt_class); > + class_unregister(&zcrypt_class); > out_class_create_failed: > return rc; > } > > static void zcdn_exit(void) > { > - class_remove_file(zcrypt_class, &class_attr_zcdn_create); > - class_remove_file(zcrypt_class, &class_attr_zcdn_destroy); > + class_remove_file(&zcrypt_class, &class_attr_zcdn_create); > + class_remove_file(&zcrypt_class, &class_attr_zcdn_destroy); > zcdn_destroy_all(); > cdev_del(&zcrypt_cdev); > unregister_chrdev_region(zcrypt_devt, ZCRYPT_MAX_MINOR_NODES); > - class_destroy(zcrypt_class); > + class_unregister(&zcrypt_class); > } > > /* Thanks Ricardo, nice work. The only thing I would do is to rename the label "out_class_create_failed" with "out_class_register_failed". Who will pick this patch? As this is part of a bundle of fixes, Richardo do you have a way to push this into the kernel? Otherwise as the AP/zcrypt maintainer I would pick only this patch and forward it to the s390 subsystem. Acked-by: Harald Freudenberger