From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E8EFC433F5 for ; Tue, 1 Mar 2022 16:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C1RgDBT8lMtBLkK9KN9keQ0ikgKlBHd+LZFD6h4j3E0=; b=d6jSN7Cq6kKMDa DptSinbCKpGBdGAxiTIDd7Xdq/u9+jkWuHESdOsqUHg/lWOr39hRqoM2oHg+gXa3WkP/WAr8lk65D ncZbRHirCjAgzvDeSsJr3R7k/8nMfPjZJnqY/gWY1dc4Q3UI53EAmd6h2QnwW9IT6T9E7h31auqt7 Jtj3D9NrwqhxGsyNne12SbA3ZcrIVvKwOOUYMcKKrLBHf6P3ssl9EG5LbEFGF55ETmgo/OKUedmNs K29e0bWsC5aPoa16UBumYWHSN+/Pr4AlYAA+y6YTaYXbz5Vrf8PmsQObhH1Qccf1T6PMnzlLsH5de mdDW2Z+S4hptcBuGGzPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nP4wn-00HSqK-NR; Tue, 01 Mar 2022 16:01:57 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nP4wj-00HSpe-PB for linux-arm-kernel@lists.infradead.org; Tue, 01 Mar 2022 16:01:55 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 221G0rsD008364; Tue, 1 Mar 2022 16:01:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=5bY54GIfqV2Jrj+zob+Kzfp/785R923S9y5UdokMSTY=; b=cTEjWFiDoDzgklnz8XmCDBVZZf/EOFyYKgfKWFVqfwcKr/T2QDXQFlsGiZt4OWQAdMGq 4adsleM18NBEfaEqHRN9Bu2TiHQi5YqOMn1patOrp6CI1m9QLvFatoDeXXAHnVZPKWuN 2L/4TUqPCjstjNtIA3M7DYAqxnj3hHVn7Vdzm5R0gE/DjuCbMqv3e1gZMp/EwNbcWDDa C3w69dyAlov+VJ+AbcHXTaFxawtdMD4YDgnIaXMAZXvuRD8VSbRZT26N2yA5pph2osAg NT8AvoDYJxYcKFUfwe9e7/YTOHs8NqCNp3i3RxhPQ6RHwx8j2Z9FVUnvuiiANKuSB/AG OA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ehpbn8haj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Mar 2022 16:01:38 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 221G1b7O011765; Tue, 1 Mar 2022 16:01:38 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ehpbn8h8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Mar 2022 16:01:37 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 221Fw2Vs007708; Tue, 1 Mar 2022 16:01:34 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 3efbu9b25b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Mar 2022 16:01:34 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 221G1QKg43450802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Mar 2022 16:01:26 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 346CE4C050; Tue, 1 Mar 2022 16:01:26 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DE1C4C044; Tue, 1 Mar 2022 16:01:24 +0000 (GMT) Received: from [9.145.23.254] (unknown [9.145.23.254]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 1 Mar 2022 16:01:24 +0000 (GMT) Message-ID: Date: Tue, 1 Mar 2022 17:01:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v3 06/11] s390: cio: Use driver_set_override() instead of open-coding Content-Language: en-US To: Krzysztof Kozlowski , Greg Kroah-Hartman , "Rafael J. Wysocki" , Stuart Yoder , Laurentiu Tudor , Abel Vesa , Shawn Guo , Sascha Hauer , Fabio Estevam , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Bjorn Helgaas , Bjorn Andersson , Mathieu Poirier , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Gross , Srinivas Kandagatla , Mark Brown , "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, virtualization@lists.linux-foundation.org, Linus Torvalds Cc: Rasmus Villemoes References: <20220227135214.145599-1-krzysztof.kozlowski@canonical.com> <20220227135214.145599-7-krzysztof.kozlowski@canonical.com> From: Vineeth Vijayan In-Reply-To: <20220227135214.145599-7-krzysztof.kozlowski@canonical.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: VwR9OiefAhT359vuW89HdrkWzjVzSJvV X-Proofpoint-GUID: 77Yd1MtoDGNnH1_0a7MDCf3mUHkKdN3G X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-01_07,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 clxscore=1011 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2203010085 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220301_080153_986838_567AF9D2 X-CRM114-Status: GOOD ( 29.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2/27/22 14:52, Krzysztof Kozlowski wrote: > Use a helper for seting driver_override to reduce amount of duplicated > code. Make the driver_override field const char, because it is not > modified by the core and it matches other subsystems. s/seting/setting/ Also could you please change the title to start with "s390/cio:" instead of "s390 : cio" Otherwise, Acked-by: Vineeth Vijayan > Signed-off-by: Krzysztof Kozlowski > --- > drivers/s390/cio/cio.h | 7 ++++++- > drivers/s390/cio/css.c | 28 ++++------------------------ > 2 files changed, 10 insertions(+), 25 deletions(-) > > diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h > index 1cb9daf9c645..e110c10613e8 100644 > --- a/drivers/s390/cio/cio.h > +++ b/drivers/s390/cio/cio.h > @@ -103,7 +103,12 @@ struct subchannel { > struct work_struct todo_work; > struct schib_config config; > u64 dma_mask; > - char *driver_override; /* Driver name to force a match */ > + /* > + * Driver name to force a match. > + * Do not set directly, because core frees it. > + * Use driver_set_override() to set or clear it. > + */ As Bjorn Helgaas mentioned, please wrap this comment. > + const char *driver_override; > } __attribute__ ((aligned(8))); > > DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb); > diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c > index fa8293335077..913b6ddd040b 100644 > --- a/drivers/s390/cio/css.c > +++ b/drivers/s390/cio/css.c > @@ -338,31 +338,11 @@ static ssize_t driver_override_store(struct device *dev, > const char *buf, size_t count) > { > struct subchannel *sch = to_subchannel(dev); > - char *driver_override, *old, *cp; > - > - /* We need to keep extra room for a newline */ > - if (count >= (PAGE_SIZE - 1)) > - return -EINVAL; > - > - driver_override = kstrndup(buf, count, GFP_KERNEL); > - if (!driver_override) > - return -ENOMEM; > - > - cp = strchr(driver_override, '\n'); > - if (cp) > - *cp = '\0'; > - > - device_lock(dev); > - old = sch->driver_override; > - if (strlen(driver_override)) { > - sch->driver_override = driver_override; > - } else { > - kfree(driver_override); > - sch->driver_override = NULL; > - } > - device_unlock(dev); > + int ret; > > - kfree(old); > + ret = driver_set_override(dev, &sch->driver_override, buf, count); > + if (ret) > + return ret; > > return count; > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel