Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp798015rdb; Fri, 22 Dec 2023 05:35:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJaLXyPhwEZpg1AXfdlDWW8/NPY+NsK2oY2vXhGWDMkfIdHEN1yZOYUBUB0KJ+RKh6RP75 X-Received: by 2002:ac8:7d10:0:b0:427:8a84:f97 with SMTP id g16-20020ac87d10000000b004278a840f97mr1504967qtb.90.1703252100612; Fri, 22 Dec 2023 05:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703252100; cv=none; d=google.com; s=arc-20160816; b=FFG4uY2ZDO2jrR6T/zg/0NZIjCHniMArEbx7VDryKAgenm1eNLNVARnDNwE6ERWYpR s1kYKmgtPDqBbWiyewSZshVqTvN2Fc7IthTCOgWTDokfWIhfue8PWJp4qgsy03edbxfH 4/DQHT3TTFZEPZrnMjnhBIjYwAsr4rEZe458uS5TsX3pde2r/9BF6BmT3dIcB0uwh0Fw 79JSMUgpj6SB/j997ebGQblbkdnzv8zIcZZC+HibpUYYackXr9U15yPK6KLAaotQTdiu 9bIHzBl0sZ7PrIAAIJX/UGcKIdc2xeUWLJbddLo5zQW6+gEX1GmJI36via5MNr7EEmJT 3uIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Q4YHcbrbLIBe0LIBElD0wMmNPwdMCP9pc0LVst1rFJE=; fh=mafsujr3g2Mrwl/Ex1xUN08pEohY5fZpEV0KrcmnVPw=; b=0fN2NRhxbsjuKaD9qrmvDrf9BnifIdoyBpYBrN7sQMXViccAHbEXb7TyRMSN0UTaLb StrYEY5Nzt4PjR+6OFvfZvBEkxrDcF1KmiEaUjOdarCYsEEeKglfqGoXtwoP5ZWbIs8N zZjs8J34nEPDi4ujwDoZ35698A9goywtYluRUqqelRZcOko08OuHgo6thJzaTfx4Rz4L 3VErI0CjxUaMiw/pJJbQHvWlY2rA3wVBhLyvGUHhxnlhffPSjEB+woy1EXtacVHZwBw0 ex+AzLr1JxgZB19nm/any3Qm1KsnfyfzWK19u1a49sJGWTVjw8Q6HE1+U2L2gQ5S8ntv fIgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QGr5HO6W; spf=pass (google.com: domain of linux-kernel+bounces-9756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9756-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n1-20020a05622a11c100b0041985eb503csi4418642qtk.693.2023.12.22.05.35.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 05:35:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QGr5HO6W; spf=pass (google.com: domain of linux-kernel+bounces-9756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9756-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D19FA1C222AB for ; Fri, 22 Dec 2023 13:34:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B7FE199D1; Fri, 22 Dec 2023 13:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QGr5HO6W" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 AB9691A707; Fri, 22 Dec 2023 13:34:35 +0000 (UTC) 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=1703252076; x=1734788076; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=iFFLsoxvmNfG3KJ8KzOw6UsU8Flpb7G6GpT6JO9Kf2Y=; b=QGr5HO6WqFLOixAxXYNs6FPXeg1QwInNUvop/kNDlJIxq9jjFLH6/0tt A7GOAp8gDcHLA19GrFRExG4A9/wwru1p0qleIzyquLcEkMe5RnobNj33l nqJ+wttK0k87qX7Hq5zTsLZZbvjaFpIFwQcEeniqc1VSdgY6tNhagqX8Q AiN2baFlCcDgqvxp8ew5M30gjjrRmwvQ273WY655fapAOZRGcliaJWE0f wgEZeoYMq7YsrFD9Gh+FvhHlSg4B9z34DHUyJ40ky8Wx9HtFSlD/byMUl JWG3qcj0Ez6NY3m9xCZvzCJyGxol1/XSEkpVfw7bj4uXc7LwwrTANcLon g==; X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="2961789" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="2961789" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 05:34:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="805943900" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="805943900" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 05:34:27 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1rGffU-00000008A4a-2XgD; Fri, 22 Dec 2023 15:34:24 +0200 Date: Fri, 22 Dec 2023 15:34:24 +0200 From: Andy Shevchenko To: Ilpo =?iso-8859-1?Q?J=E4rvinen?= Cc: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Igor Mammedov , Lukas Wunner , Mika Westerberg , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/7] resource: Handle simple alignment inside __find_empty_resource_slot() Message-ID: References: <20231222122901.49538-1-ilpo.jarvinen@linux.intel.com> <20231222122901.49538-6-ilpo.jarvinen@linux.intel.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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231222122901.49538-6-ilpo.jarvinen@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, Dec 22, 2023 at 02:28:59PM +0200, Ilpo J?rvinen wrote: > allocate_resource() accepts alignf callback to perform custom alignment s/alignf callback/->alignf() callback/ ? > beyond constraint->align. If alignf is NULL, simple_align_resource() is > used which only returns avail->start (no change). > > Using avail->start directly is natural and can be done with a > conditional in __find_empty_resource_slot() instead which avoids > unnecessarily using callback. It makes the code inside > __find_empty_resource_slot() more obvious and removes the need for the > caller to provide constraint->alignf unnecessarily. > > This is preparation for exporting find_empty_resource_slot(). Reviewed-by: Andy Shevchenko ... > if (avail.start >= tmp.start) { > alloc.flags = avail.flags; > - alloc.start = constraint->alignf(constraint->alignf_data, &avail, > - size, constraint->align); > + if (alignf) { > + alloc.start = alignf(constraint->alignf_data, > + &avail, size, > + constraint->align); Maybe one line? It used to be a longer line in the old code. > + } else { > + alloc.start = avail.start; > + } -- With Best Regards, Andy Shevchenko