Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp108719lqe; Tue, 9 Apr 2024 16:42:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOueJu88UTHMNMUFj4PLOkrvd5cL/S0eDqj1iJsL+KQf3LBh5mMQXMBvL+3GA/arO5hfM3Dym4jTC41USyJea78fdyXpezyG2uNn3Z1A== X-Google-Smtp-Source: AGHT+IFqMnqkbSpQOo4n7eLE/1VcEPyuRxkSqeblh2TbJGHQJ0jVfPhBHbXYolOM3IegEy/APT1O X-Received: by 2002:a17:907:7ea0:b0:a4e:6957:de25 with SMTP id qb32-20020a1709077ea000b00a4e6957de25mr688437ejc.57.1712706154576; Tue, 09 Apr 2024 16:42:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712706154; cv=pass; d=google.com; s=arc-20160816; b=XyxOpRO9hMIBDKaTwS03N/7cw/YcfOUJW/V31ItrtbNhNNFP7cTcXLokkMxs3RHWC1 6hmwSNMHugRXtU4COiHZifERS4aPPIz2DiubqxE4/f6Z81hNFjZlmnH4LT1lfOuShczc Mr4FS6SaiN48aL3ez5khZS7tYmsSLYyCdIKwoYA2E/OsNrl+67YOBVrOgXPB+PsvkdN7 Fu3DzycGUgBX4r/IWtJO0ON9KV73kp2Z2nV78eK92wuM8gPCM39Bec2jHnl9wy1F6Gix Z9rN6mmEUrrl0OvjJO6eRnzq4RaEniy9Hf3/EcBjMgOs87g+ft7iPOXlAOIhBRq3xIHl MCNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=t5H7m/t+mjWRrVFVFLmjAiWOxbQcM3de3a440Mabq7M=; fh=ff/2rgOSjULH/L3z/Y+PR5zkUTuzVJ4XEK4mTDNeRIg=; b=MbXotGiWA9AXmbCEovje4Y6HMO2PbBL8UuKnFxivlp5GF/9pvlSSWWeQ1YquNiC2rU d0cDRmYMhjh22YCBillRPJMehDi3hXmTeZV0/vVNp21EgI+QyStgKgudYLBERC8japja tngPHjaNltwnLmbsUWYAK+qZn6Tl4Pltdv3mAY+08p4SnkXmlt03gEUIZuVt9cYuLQTj FDWYbi2ZTYxXiZNkDL9/tnbhnxztI4C5/kPuUgpfEFaFo2mtIgckF0lVBIyqndVA2vgO Mu5cNSqJg0oBRfN7F41xqhOAtModWnmpuld+w2xaqQlB8DSX/KllOV1480EkFu2VJG0Q SnlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IlnmNzyY; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gb36-20020a170907962400b00a51be962599si4062739ejc.243.2024.04.09.16.42.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 16:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IlnmNzyY; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-137708-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137708-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 284E61F22CC5 for ; Tue, 9 Apr 2024 23:42:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C669015956C; Tue, 9 Apr 2024 23:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IlnmNzyY" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 2010F159211; Tue, 9 Apr 2024 23:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712706116; cv=none; b=QCCiy/+5Yq1v9cXgvo781ox0ar8hNz6JNW088aRq4tcLqfFXRAG2ejtiMa7q7BYiOvwRQb2ufbkHQ6TgzEdzInqeTXDafKytlgeuAgwm/SrAA+gXXmq7RchWDnWEyKpK3xNmqH/fbtPnmic6eAXsoJbelVRQ2kM7ETS1J3U4haM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712706116; c=relaxed/simple; bh=fV42Klm8V51peR+/cC+IG71NY4osEXZZZUE0irhWd4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EA4OkiJVWKJPZItw4jJfDBWw+iDun2WI7E9s3lUE3etTGu1UWWL139SkD5gb9mt3j3+QOAFYeEzPAZqSW/3q1uk3X96j51S4xLa2VB1jbcd9xRmd9xCnzaDKOB0l8gG7r+HMmX7LAA4iGJqmvtunQvlXreHcpl0ebJRw3q8Bql8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IlnmNzyY; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712706115; x=1744242115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fV42Klm8V51peR+/cC+IG71NY4osEXZZZUE0irhWd4s=; b=IlnmNzyYF8NLvOrIXtFv792H1hbho5Fuw10GwSk09w6mQw49JpPbZy8y 5xA2GKO7kn5eEoVZ2Z76oA6omOKIKFG4FwWXf7yhtDNaIbhiO5y75nEae xQvmXtqsYmM2Xb9yY6rCd68lScmS8Ju9jQXei7TjwuzSlw3+YXMi2EVZP 0rBBfGjgoj0eWPL8T+pV9/XznmpRAwVFJAxPgexnjDV2YQ7IVhSr9HiHH px9ADmFwtLEr5KZgF8sdY8eVFIgHsPZpfzR8hebZkY53/DDX9HxXd6zGG q58jcWcsRXjiCyoDsTBhsYTPbJzMpGZUBU5AQB/tyFhUdt+2kDLR8M+qW Q==; X-CSE-ConnectionGUID: ud8l1UMtRnakDKCjNjyogg== X-CSE-MsgGUID: QjMINPkZRP63Gp6JBnnbQw== X-IronPort-AV: E=McAfee;i="6600,9927,11039"; a="33455091" X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="33455091" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 16:41:55 -0700 X-CSE-ConnectionGUID: py15v8eaS66SxBPSF8GiOQ== X-CSE-MsgGUID: aapubMLTQQiKgUO0JOSqJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,190,1708416000"; d="scan'208";a="20261786" Received: from sj-4150-psse-sw-opae-dev3.sj.intel.com ([10.233.115.74]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 16:41:54 -0700 From: Peter Colberg To: Wu Hao , Tom Rix , Moritz Fischer , Xu Yilun , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Russ Weight , Marco Pagani , Matthew Gerlach , Peter Colberg Subject: [RFC PATCH v2 3/9] fpga: dfl: migrate AFU MMIO region management driver to dfl_feature_dev_data Date: Tue, 9 Apr 2024 19:39:36 -0400 Message-ID: <20240409233942.828440-4-peter.colberg@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240409233942.828440-1-peter.colberg@intel.com> References: <20240409233942.828440-1-peter.colberg@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This change separates out most of the symbol name changes required by this patch series for the file: drivers/fpga/dfl-afu-region.c. This is done to split a single monolithic change into multiple, smaller patches at the request of the maintainer. Signed-off-by: Peter Colberg --- v2: - Split monolithic patch into series at request of maintainer --- drivers/fpga/dfl-afu-region.c | 51 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/fpga/dfl-afu-region.c b/drivers/fpga/dfl-afu-region.c index 2e7b41629406..b11a5b21e666 100644 --- a/drivers/fpga/dfl-afu-region.c +++ b/drivers/fpga/dfl-afu-region.c @@ -12,11 +12,11 @@ /** * afu_mmio_region_init - init function for afu mmio region support - * @pdata: afu platform device's pdata. + * @fdata: afu feature dev data */ -void afu_mmio_region_init(struct dfl_feature_platform_data *pdata) +void afu_mmio_region_init(struct dfl_feature_dev_data *fdata) { - struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata); + struct dfl_afu *afu = dfl_fpga_fdata_get_private(fdata); INIT_LIST_HEAD(&afu->regions); } @@ -39,7 +39,7 @@ static struct dfl_afu_mmio_region *get_region_by_index(struct dfl_afu *afu, /** * afu_mmio_region_add - add a mmio region to given feature dev. * - * @pdata: afu platform device's pdata. + * @fdata: afu feature dev data * @region_index: region index. * @region_size: region size. * @phys: region's physical address of this region. @@ -47,14 +47,15 @@ static struct dfl_afu_mmio_region *get_region_by_index(struct dfl_afu *afu, * * Return: 0 on success, negative error code otherwise. */ -int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, +int afu_mmio_region_add(struct dfl_feature_dev_data *fdata, u32 region_index, u64 region_size, u64 phys, u32 flags) { + struct device *dev = &fdata->dev->dev; struct dfl_afu_mmio_region *region; struct dfl_afu *afu; int ret = 0; - region = devm_kzalloc(&pdata->dev->dev, sizeof(*region), GFP_KERNEL); + region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL); if (!region) return -ENOMEM; @@ -63,13 +64,13 @@ int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, region->phys = phys; region->flags = flags; - mutex_lock(&pdata->lock); + mutex_lock(&fdata->lock); - afu = dfl_fpga_pdata_get_private(pdata); + afu = dfl_fpga_fdata_get_private(fdata); /* check if @index already exists */ if (get_region_by_index(afu, region_index)) { - mutex_unlock(&pdata->lock); + mutex_unlock(&fdata->lock); ret = -EEXIST; goto exit; } @@ -80,37 +81,37 @@ int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, afu->region_cur_offset += region_size; afu->num_regions++; - mutex_unlock(&pdata->lock); + mutex_unlock(&fdata->lock); return 0; exit: - devm_kfree(&pdata->dev->dev, region); + devm_kfree(dev, region); return ret; } /** * afu_mmio_region_destroy - destroy all mmio regions under given feature dev. - * @pdata: afu platform device's pdata. + * @fdata: afu feature dev data */ -void afu_mmio_region_destroy(struct dfl_feature_platform_data *pdata) +void afu_mmio_region_destroy(struct dfl_feature_dev_data *fdata) { - struct dfl_afu *afu = dfl_fpga_pdata_get_private(pdata); + struct dfl_afu *afu = dfl_fpga_fdata_get_private(fdata); struct dfl_afu_mmio_region *tmp, *region; list_for_each_entry_safe(region, tmp, &afu->regions, node) - devm_kfree(&pdata->dev->dev, region); + devm_kfree(&fdata->dev->dev, region); } /** * afu_mmio_region_get_by_index - find an afu region by index. - * @pdata: afu platform device's pdata. + * @fdata: afu feature dev data * @region_index: region index. * @pregion: ptr to region for result. * * Return: 0 on success, negative error code otherwise. */ -int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, +int afu_mmio_region_get_by_index(struct dfl_feature_dev_data *fdata, u32 region_index, struct dfl_afu_mmio_region *pregion) { @@ -118,8 +119,8 @@ int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, struct dfl_afu *afu; int ret = 0; - mutex_lock(&pdata->lock); - afu = dfl_fpga_pdata_get_private(pdata); + mutex_lock(&fdata->lock); + afu = dfl_fpga_fdata_get_private(fdata); region = get_region_by_index(afu, region_index); if (!region) { ret = -EINVAL; @@ -127,14 +128,14 @@ int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, } *pregion = *region; exit: - mutex_unlock(&pdata->lock); + mutex_unlock(&fdata->lock); return ret; } /** * afu_mmio_region_get_by_offset - find an afu mmio region by offset and size * - * @pdata: afu platform device's pdata. + * @fdata: afu feature dev data * @offset: region offset from start of the device fd. * @size: region size. * @pregion: ptr to region for result. @@ -144,7 +145,7 @@ int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, * * Return: 0 on success, negative error code otherwise. */ -int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata, +int afu_mmio_region_get_by_offset(struct dfl_feature_dev_data *fdata, u64 offset, u64 size, struct dfl_afu_mmio_region *pregion) { @@ -152,8 +153,8 @@ int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata, struct dfl_afu *afu; int ret = 0; - mutex_lock(&pdata->lock); - afu = dfl_fpga_pdata_get_private(pdata); + mutex_lock(&fdata->lock); + afu = dfl_fpga_fdata_get_private(fdata); for_each_region(region, afu) if (region->offset <= offset && region->offset + region->size >= offset + size) { @@ -162,6 +163,6 @@ int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata, } ret = -EINVAL; exit: - mutex_unlock(&pdata->lock); + mutex_unlock(&fdata->lock); return ret; } -- 2.44.0