From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2E1316DEB1 for ; Tue, 7 Jan 2025 16:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736269190; cv=none; b=YZF3zQADAE3vVWuY0mRbAOB3wLC3W+JMiUfUfOthJ0clWezD2SpYZnrnG4SNS395YY558wBkE8Ab0yFXt+M2fkK7MJC7+CdFkLNk3KZqNkcpj5O2nLpMT5l67+uDw/xd9PSEdWU6c8vr4JHq0UZJ+5+KcFkAd9NzwcWvxmV6o5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736269190; c=relaxed/simple; bh=OD7fLjBzgJvCol+8Oop6voMXAH2wtyr8HiGRUk7YY3Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Pk1LYaOHdFDvm7pcKWUdlroy+iJRmMM70Dm2J0f4Fm7lJjN/g/+4IcG/ydoFdnDsil5SGmgBnC/GPLnsg2/KKdw925Cl4oofYtCubVtsYzxgdQ3RfOCuAUKubMYllg8tlLpsfGw4d1yuyuZbP7RpyToxnFbQzfyOblk3J8+Ss9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Nmtft64w; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Nmtft64w" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b6ed0de64aso1332118685a.0 for ; Tue, 07 Jan 2025 08:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1736269186; x=1736873986; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Mt7WxvlVSNoHvlLP4I52D+d/g/XTQa58yJqTdwgiX2M=; b=Nmtft64wgqD96CtyZVDzp8ywoJYL9/Kfag+cdWAYWGuQkbH4KmC70sUhZvHv22JMNd BnCCOZ53fDihMTYRKQvOM+zGa1c0T0+1xJ1kOMil1r7U2zbAsxLnR9TDJWRwCc6YnpP5 Sfi2QTO/tI2rh1bRnOcNpsPDf+BG0hb8u7z8Lr6IdLFV0wudLhzjMjp/0frpmMlEkZvv L2QKe+oYYBh7j4VC3B5DR7MtZLb4uVihhZu+bi9b3utSg/m6z5ygG9U0RpG1gXottH4G xXco3HVqiV0LK+8iH/j0TxKuyjHDznFQime3Zv2XfocnlqaKBk7Mi8ntNQh28tdT3blU SYNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736269186; x=1736873986; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Mt7WxvlVSNoHvlLP4I52D+d/g/XTQa58yJqTdwgiX2M=; b=X2aF0q5sgGWtzGlnoYQd8vyPmATBYJK+EmqyKMznbdwCssbFuaV/XoNPZg+byLFgS7 KKEpdPV/QY4h4aK1Ve1ClLaCAHLPoUP+IdIjV9BgQjUZRAdWl9LVbNfX0N2vcpnER5No kyPUVeMoGKYspCDKz4xSn5Qz6PHwczRGSLdLpiRB7SelXF8eOlblflwEQMnr2FSFbtCg ZSRtDQNJhpxX3TMitNM/g79ZI+SorJJJujK03daz963aJsPvCF4kfqYqEY1jlCUSs0IU ULIdkxF5m+ZRKZzPwp+8U468iepUoDhVzlIl0l8uMy3LNS2kCdFUttKMNmu5qCbKQAxc K7zg== X-Forwarded-Encrypted: i=1; AJvYcCXw5/RB/cD17vgUDw/siEvCb8qbaWpXKkstyR0PtdmGyQBXh21y5CHwnxXOla2dA/x0LxhrbkhK/1126d4=@vger.kernel.org X-Gm-Message-State: AOJu0YyusR8aHxjyX29blabT8EZwLrjRwmPuerdxLkNg0xOQFGzjPO0q inXTBWzcHeI9X8PA7l+dNkPGPK3PdvO3V5eOqDaoCzouQ/7na1dPAxHNWzhVyIz7uOYbm+Q0xZi 1 X-Gm-Gg: ASbGnctsJa0/QPKKYXUlzHRmVWzxSivIbLWhNsCyUsm9rBPsMGOsp7I5/O+d2YwpioZ w2yfLj2fUrpXi5bN/cZ4WiaYbqvvHohWrs0xAVGIXWxofbUgWr4pXwBzWHuIsjTfrJ3jSOzO2p3 gPYsJkD4k34DUfRg5t0UQ/0OHFvNpzkhvzkttc0t3eVBLzi5jZXfuXGTcQQ5UZnMjSNtGxLojPI 948as/31SE/GaslUt7fFFwRCk+l2WiXPXXYUFOenAJ/78cCugjHUau+6clUIktljNKX28Tqq7RJ wuSLJruihtAEX8tD/AaQLNE8AMX7r7XqPtQK9UU= X-Google-Smtp-Source: AGHT+IHfm5zIVuyMdrgv+Rk2m27gedpgNh9B/JTICZcvopWvsRg0rdFhornv3nZnKe7mjSHWyAXU4g== X-Received: by 2002:a05:620a:1d04:b0:7b6:d0be:ca31 with SMTP id af79cd13be357-7bb902fca7emr528177285a.25.1736269185871; Tue, 07 Jan 2025 08:59:45 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b9ac4cd53fsm1608171885a.112.2025.01.07.08.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 08:59:45 -0800 (PST) Date: Tue, 7 Jan 2025 11:59:43 -0500 From: Gregory Price To: Robert Richter Cc: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, "Fabio M. De Francesco" , Terry Bowman Subject: Re: [PATCH v1 07/29] cxl/region: Factor out code to find a root decoder's region Message-ID: References: <20250107141015.3367194-1-rrichter@amd.com> <20250107141015.3367194-8-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250107141015.3367194-8-rrichter@amd.com> On Tue, Jan 07, 2025 at 03:09:53PM +0100, Robert Richter wrote: > In function cxl_add_to_region() there is code to determine a root > decoder's region. Factor that code out. This is in preparation to > further rework and simplify function cxl_add_to_region(). > > No functional changes. > > Signed-off-by: Robert Richter > --- > drivers/cxl/core/region.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > ... snip ... > * one does the construction and the others add to that. > */ > mutex_lock(&cxlrd->range_lock); If the function must be called with the cxlrd range lock held, then the function should have a comment/contract that states this. > - region_dev = device_find_child(&cxlrd->cxlsd.cxld.dev, hpa, > - match_region_by_range); > - if (!region_dev) { > + cxlr = cxl_find_region_by_range(cxlrd, hpa); > + if (!cxlr) > cxlr = construct_region(cxlrd, cxled); > - region_dev = &cxlr->dev; > - } else > - cxlr = to_cxl_region(region_dev); > mutex_unlock(&cxlrd->range_lock); >