Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp421368pxw; Fri, 8 Apr 2022 10:46:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwO6Xi6znIP6IpyI8PUHcnMsJkQxRCjooc+8VVr0yc/K5kRNUfXuVMVx6SuemVnc/CGs8e X-Received: by 2002:a05:6a00:188f:b0:4fa:ece9:15d9 with SMTP id x15-20020a056a00188f00b004faece915d9mr20575190pfh.28.1649439989769; Fri, 08 Apr 2022 10:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649439989; cv=none; d=google.com; s=arc-20160816; b=MZHw41cc0NUuLOxjV8sPu/aRIs42wG9H1Bp1XPkk9HEgaOBxwy7RxZHVuPVeGeC5ET 9YLeHe+VP7BJPXhi4+K9HI61jd99WXlvkKbgtF0w0F0+xX0btt8cXvDf9R7wwASMMPUg mnNKwbeYmdrwpNkvQGViQP4WJ0mFoYxLWtzRvcuKYA+Bi9UV4C0nuP5ZCboewhhFtc+r rVZ0vQNfuNeYCOhuPOumUHPCeUDqVll5eHLnbpmWBxtgtZnPgLdK7iwzlS7kBWVR7oz2 uqjIxH8PUFWqXYIWaNlnHj0A/2aflmpfCiu3H9IDYFg6LTyoxfWIuwCydn+ghYBXkFtk OX9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:subject:user-agent:mime-version:date:message-id; bh=RXONVU2P9fvlxMfr2ynVK54FniTC2Y9LV6pHrHYWpvg=; b=NK1fRHyP+BXN9Qupe3GqajnX9h0tpB9hWaJ6TGh7NZVnElHSvUdtLerm/4YiNUlQcv tRhr4BI2tqtqy+MvOmUwgQgSNGo/WMGSbgxrEA/v5Aja9/35LBtCWyoQ9m6jg2Bvkm+G sbDDBKCZdgxDmezQSNnR8sQmW1Aj3FqA/Iqp1h8wGWMiSVhQcQbjt53uRe/Lk+3TKewR JQWYTHjlb4kXSbpOSafXt0dAOKdpKBqA2u3fuQKdS2+N9sVAHgQSaICd/qoEnodQCo81 9uW6re1+agKRbGwPrmvjT2sJFrrlTde85g23bJ2W0QGUltL3eYf9P4lWs5ObIhYu5BS5 4jFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a056a0022c800b004fa843103dbsi1813631pfj.193.2022.04.08.10.46.13; Fri, 08 Apr 2022 10:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236024AbiDHNAI (ORCPT + 99 others); Fri, 8 Apr 2022 09:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232841AbiDHNAE (ORCPT ); Fri, 8 Apr 2022 09:00:04 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC6A10E8; Fri, 8 Apr 2022 05:57:59 -0700 (PDT) Received: from fraeml710-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KZdXh08ymz67kSQ; Fri, 8 Apr 2022 20:56:04 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml710-chm.china.huawei.com (10.206.15.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 8 Apr 2022 14:57:56 +0200 Received: from [10.47.91.39] (10.47.91.39) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 8 Apr 2022 13:57:55 +0100 Message-ID: <7b3885e3-dbae-ff0b-21dc-c28d635d950b@huawei.com> Date: Fri, 8 Apr 2022 13:57:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 1/4] scsi: core: constify pointer to scsi_host_template To: Krzysztof Kozlowski , "James E.J. Bottomley" , "Martin K. Petersen" , Alim Akhtar , "Avri Altman" , Doug Gilbert , , References: <20220408103027.311624-1-krzysztof.kozlowski@linaro.org> <2a88a992-641a-b3ff-fe39-7a61fff87cb6@huawei.com> <4c3be5b6-50ef-9e9a-6cee-9642df943342@linaro.org> From: John Garry In-Reply-To: <4c3be5b6-50ef-9e9a-6cee-9642df943342@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.91.39] X-ClientProxiedBy: lhreml718-chm.china.huawei.com (10.201.108.69) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/04/2022 13:32, Krzysztof Kozlowski wrote: > On 08/04/2022 14:14, John Garry wrote: >> On 08/04/2022 11:30, Krzysztof Kozlowski wrote: >>> Several pointers to 'struct scsi_host_template' do not modify it, so >>> made them const for safety. >>> >> Is this standard practice? What is so special here? > This is standard practice and there is nothing special here. Pointers to > const are preferred because: > 1. They add safety if data is actually const. This is not yet the case, > but scsi_host_template allocation could be made const with some effort. To me this seems better, but I think that some drivers might modify their scsi_host_template (so not possible) > 2. The more const variables, the easier function contents and its impact > is to understand. This is actually the biggest benefit when dealing with > code touching different structures. > > In general, constifying is a common practice everywhere in the kernel. Thanks, John