Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp479381rdb; Sat, 30 Sep 2023 12:08:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRk250XF+0sEBszyjpV5/7+IQGeVuZgM4TRV+lXS5VI5Qdr249rgLPZf9aOTO4C7bShAyf X-Received: by 2002:a05:6a00:2d96:b0:68a:586a:f62 with SMTP id fb22-20020a056a002d9600b0068a586a0f62mr7315172pfb.4.1696100912746; Sat, 30 Sep 2023 12:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696100912; cv=none; d=google.com; s=arc-20160816; b=BERe0jmjUgpx55X7ME5WCopoJL+KAFAuVZ4rRWIWgyDwFUvkGkMmnJEttXRJx8x4xl +zBKx/YRCG+dK2/d6GYOrBhII/cRbgKsE03Ueyj2SZnPxmdyUy2ukzCInojJqmHcJGci 0ACm7m4rPTgF1g8zGWjGfWW1avjTqAp65iwo/ehH6aOMhD3Xi9ZRi0+oqstFH/dgPZ+1 tDXe2LS1UW6R/v8NV5kr+2OW5M62hd7KlhX0H+8DCxsAk5+HaVgV+mTwdW1IAq7xP9hQ VgUJitH5Q6ytF8ZjVwmgqRVZ7HSJ65Ty3PLGOzHcTlzDUbLSsApTvx2mR+SPhgxY1yzV 9s8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZF8dCynJNmgqXSDQXz7BN5OK2ldMOTad31zO+N1ZA4w=; fh=WxcXzAXi1awalX5nBNdKiu2pCszhVA/a0vtqlN5we7w=; b=Cv2y3JF479OSCkRArKfQ8nLO4x7NdlghVm+LBGnrVOb5FCj5HhdiXLB5tSJWKJc51i +xS4jPx0wWgQiYc3s/Ji6G+TB6a850EVCnxmbechPUcndIkUZRbzXjKCrioJ+xB+nljy ffmoFp0lnRsK1AW5ccb0Xqat1cinB2uf/tzKOQg6YQmQ9MynRJrEGKa3WxxcyT7DXpkY 2gIqmm6D6ko0WW/1tm3g4fn5ANzXRkgfxu+29cpEWWjYjx5C7c15POvPFBDgq1irQgLK OxhYFO06A8d2D0NHyCAX2+0ZkkviAFRM2n7zwuKRJWKWw2RNMBgwY+nwjK1g+MlhlJMq Q69Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cmhqCOaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id z17-20020aa78891000000b0068fb5cec8cfsi24772869pfe.267.2023.09.30.12.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 12:08:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cmhqCOaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 5F7C3832658C; Tue, 26 Sep 2023 10:54:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234986AbjIZRyO (ORCPT + 99 others); Tue, 26 Sep 2023 13:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjIZRyN (ORCPT ); Tue, 26 Sep 2023 13:54:13 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F5779F; Tue, 26 Sep 2023 10:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695750846; x=1727286846; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ZpXMYZAgko950/Kdxjip8wxCTn7a5ku/VCBGbQqq6E=; b=cmhqCOaaI/RQF6Z+j+XnGvf020o6G68gFmZU29ZZtrn1P+I89RrJI6Ri Vn3FwkcjHIlPb48oGp+RDSC6Yr5a7Xf4wXemyArBj9ElVfrt35ZG368UB bOlpAQ0CTg5li67CZhPU4q/TRLGoa6ESks8UltBXopvul/g8FRyxN0fMD vY0aHUfPBAJjAzyGIi3glCHBDcObcPOhJlqjxjZ5WfKtZV9l+ivDjD6P/ wYZGEXLSKxOumGEs4k3dIy0XoAQVAYlTX/Nx45ejknJ3o4s8wLxpXBT9E e3AAbSWhM2p0mULuC8KoKmYzuhdWvAhlx8I5a9mxQmwl1X1qY3NkoDIaZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="366693051" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="366693051" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2023 10:53:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10845"; a="864486747" X-IronPort-AV: E=Sophos;i="6.03,178,1694761200"; d="scan'208";a="864486747" Received: from spandruv-desk.jf.intel.com ([10.54.75.14]) by fmsmga002.fm.intel.com with ESMTP; 26 Sep 2023 10:53:50 -0700 From: Srinivas Pandruvada To: hdegoede@redhat.com, markgross@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada Subject: [PATCH v2 3/3] platform/x86: intel_speed_select_if: Remove hardcoded map size Date: Tue, 26 Sep 2023 10:53:49 -0700 Message-Id: <20230926175349.989618-1-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 10:54:12 -0700 (PDT) The driver is using 256 as the size while calling devm_ioremap(). The maximum offset can be obtained from isst_mmio_range. Add a field "size" to the isst_mmio_range and use it instead of hardcoding. No functional impact is expected. Signed-off-by: Srinivas Pandruvada --- Changes: As per Andy's comments pre calculate size .../x86/intel/speed_select_if/isst_if_mmio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c index ff49025ec085..13e068c77d50 100644 --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c @@ -18,16 +18,17 @@ struct isst_mmio_range { int beg; int end; + int size; }; static struct isst_mmio_range mmio_range_devid_0[] = { - {0x04, 0x14}, - {0x20, 0xD0}, + {0x04, 0x14, 0x18}, + {0x20, 0xD0, 0xD4}, }; static struct isst_mmio_range mmio_range_devid_1[] = { - {0x04, 0x14}, - {0x20, 0x11C}, + {0x04, 0x14, 0x18}, + {0x20, 0x11C, 0x120}, }; struct isst_if_device { @@ -114,13 +115,16 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pcu_base &= GENMASK(10, 0); base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12; - punit_dev->punit_mmio = devm_ioremap(&pdev->dev, base_addr, 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].size); if (!punit_dev->punit_mmio) return -ENOMEM; mutex_init(&punit_dev->mutex); pci_set_drvdata(pdev, punit_dev); - punit_dev->mmio_range = (struct isst_mmio_range *) ent->driver_data; memset(&cb, 0, sizeof(cb)); cb.cmd_size = sizeof(struct isst_if_io_reg); -- 2.41.0