Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2074419rdh; Tue, 26 Sep 2023 11:30:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbo6bAqUzOFHxQRpG9LNOe7JLJKcCjAVgqSRgV3OsPCJbETC+qzep3e034ZG/nj1VQYLYn X-Received: by 2002:a05:6a00:1d0c:b0:691:2d4:23b5 with SMTP id a12-20020a056a001d0c00b0069102d423b5mr9370190pfx.31.1695753010175; Tue, 26 Sep 2023 11:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695753010; cv=none; d=google.com; s=arc-20160816; b=DSuCt+WzIV5uaICeE25x0lpyMshbnrvTEW7zb/+a/X1Ca35j0iriP9W+nY0RyDwasQ 4sCjxfB81g/4btNk4tzV+vBpY/E4l4C5Y5i4SJNrWHpuoXJKEv5PtZaPI/EP0zaiHLT7 KA1TF1vGmemmmYsA04Qmh6F3YA6+MmR8BigxwNRlkhmJx+7tYmMuOAF92Zgdjv93MUg5 Ig7S8Mk7X7RVLUocJaYlxXWHD1dimZdhGRX10Vq+zzrEOmKJK6l/f1OGm3iZTQj45Nbx 37DCwTv3Cl7N/Tjt02NUzoVlOcPbjD19nKRUl6hcz0lIfc6ogTqWf6OJUtY8LE10Xslc J3Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JFnu7hTFsj4OlWcOzHvdHNmzm/r2ZaorDmcb8Y1QJG8=; fh=qFrUizFeUkB92JudZiBTkRJZ3YlPnhcgFrkohK0X7Hc=; b=thUfgoF78q8ywSkpvKEqEeFUHsfoZB2mVLlyCd2mDwLTHbcn9X07SYJty4u7OiW3Ac XXh3Dp5cjdLJih+dWtfxS1sjhvZ+jVvbW9NtjwuipeeBuEepaD5eJXLeK9eIm2leZfd7 B3tQ0e3gWV70fNBJ4wFFzQAFKSbTwpJsMqihSEfGZuQcxGGONDznMXJb/Zh3G5n8sUCS acRVfSN+2OGzvSaMW+nXXQf21EYkQdFg1SZaylnrtLYQp7nCRMMqXJ4kmKxXzFZffmEp +MIFPeHbd6GGTIaFRMgJPh4Y80Mb9KTDLxYAXSuAEDmGP2q6x6hywRgL+4NHQ2bRGaF8 aYFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QWJm7IqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j73-20020a638b4c000000b0057823b96685si12840275pge.681.2023.09.26.11.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 11:30:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QWJm7IqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 81D5D8293C8D; Tue, 26 Sep 2023 08:23:26 -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 S233299AbjIZPX1 (ORCPT + 99 others); Tue, 26 Sep 2023 11:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbjIZPX1 (ORCPT ); Tue, 26 Sep 2023 11:23:27 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42C910A; Tue, 26 Sep 2023 08:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695741800; x=1727277800; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=IxX9oSdDKpmtGZK8qvc/vCzSVX/ryfcoY7TfJCkjJ90=; b=QWJm7IqEYFV1J8DIr3/5mxlFai/iW1+tblaKv4Gvbbt9qFtZEuW/ZG3h WDBN21z7s8suxyXYqI5OmXZ3LG8o63OB6ajbTW5jJyWuGSAXuUqUZbH54 TsOPFpIW8d/W5J7xoducKrB6ZRNRqA822SAc6qt2T6K6uLV0p0UJN4l4i zDPw1KrcL7uwrrbc0z8RMr1JatGnBqVxS2yfqsO2cDvMjbsvAOTLqc6bj GZJZ8V65BVjj4F7G66pFaw/w78/4GFc/Kar1P20ajg6jXeMmcWQv44/5n 685nbRNOe54x4FI3xOcOtj567gLhw1GlyULtmI3lKd84aEljAC0ygZkcb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="385438462" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="385438462" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:23:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="814519207" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="814519207" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga008.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 08:23:17 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1ql9u4-00000000eI6-3CZ5; Tue, 26 Sep 2023 18:23:12 +0300 Date: Tue, 26 Sep 2023 18:23:12 +0300 From: Andy Shevchenko To: srinivas pandruvada Cc: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size Message-ID: References: <20230925194555.966743-1-srinivas.pandruvada@linux.intel.com> <20230925194555.966743-4-srinivas.pandruvada@linux.intel.com> <9cab732f92d529d76b9e40f91ede1460320f1da4.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9cab732f92d529d76b9e40f91ede1460320f1da4.camel@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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]); Tue, 26 Sep 2023 08:23:26 -0700 (PDT) On Tue, Sep 26, 2023 at 08:04:46AM -0700, srinivas pandruvada wrote: > On Tue, 2023-09-26 at 16:16 +0300, Andy Shevchenko wrote: > > On Mon, Sep 25, 2023 at 12:45:55PM -0700, Srinivas Pandruvada wrote: > > > The driver is using 256 as the size while calling devm_ioremap(). > > > The > > > maximum offset is already part of struct isst_mmio_range. Use the > > > maximum offset (end field of the struct) plus 4 as the map size to > > > remove > > > hardcoded value of 256. ... > > > +???????punit_dev->mmio_range = (struct isst_mmio_range *) ent- > > > >driver_data; > > > + > > > +???????punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, > > > +??????????????????????????????????????????? punit_dev- > > > >mmio_range[1].end + sizeof(u32)); > > > > Can we rather fix the mmio_range driver data to have end be actually > > not the > > offset of the last dword? (Better maybe to keep length there.) > > > We can. But that has to be separate patch on top as there are other > places this range is used. Still you can add a third member for now and then clean up it later as it's all in one file. ... > > With help of > > > > ????????struct resource r; > > ????????... > > ????????r = DEFINE_RES_MEM(base_addr, mmio_range.beg + > > mmio_range.len); > > > > you can switch to devm_ioremap_resource() API. > What is the advantage of creating a resource and then call > devm_ioremap_resource()? It manages resource via global resource management and also prints an error messages in case of errors. -- With Best Regards, Andy Shevchenko