From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 BAB1578F3A; Mon, 13 Jul 2026 21:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783976812; cv=none; b=EZoqOg1AT88MUIf4ZB+D4fC3DIDbpaZDNWKQ9lsq5agVlzrMYbk3I4U3kFjAkPnp5O/b+3h76apBbmYLWJ7M2WGtZmJvy2DIkMGmy+bRgptud6+wQ6zPtBZeXKFS4mncj2mpw989TPmvYusSAco/Z3XLxXveJNdRWQEUHBcCS/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783976812; c=relaxed/simple; bh=MVa1wRBJRU6+fCy+2HEUjLBXLS095SdQAspyYiCbT3E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c58QtTDnRMSeIjBlW9rfPRWXxx4zkARJv6AatfWRzNvLr4Z/k2b0sAMpGLxRyg7YJF2K/Sl47PafTPygtCuwuzfRJaBnpuKvKpRlCha1FayYxJpdtlmeQduZ6BNGr0oOZaeeb07LJuPCoGjbh8j/1in1kVk+nfs2T9TVXf9HOWA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Igalia.com; spf=pass smtp.mailfrom=Igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=MEtLxz+Q; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="MEtLxz+Q" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xQrScTMErwGvqTbe4/xRXxRntlCADJUSrD0i3fE7pTU=; b=MEtLxz+QaBvAuYqwlzpVK9DTMK 2vEikTmQdo/d7diC4pmJnjScn04vhjDtET+9wHUXgiQHEmu0BIMMxxhxshP4pVaYWrXatPaYZ9UqU mc7YRYAqKwsAHGUmizXgKPSxzM/lR3Gk1SW1YMdgGr1ylDHKsHYyNGACbJzqA8tE7ufKdKb5y0ko8 BAS0RWViFgPHrjDdIEE4xm0VgTh5XjXn4fV/TRBbRBTN928yOaf1tbGjAI8++zHNBrx68UpXzoWbo fKemjPL6WqzUQzwwWLoDWB+nc2P+XC3EtFfudlRWuulA7M+RJqiCW7gImoyIrJRQ0COXpx48MLmcI 59Z0HZjA==; Received: from c-73-157-168-91.hsd1.or.comcast.net ([73.157.168.91] helo=[192.168.1.133]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1wjNr8-00Eg7T-Rb; Mon, 13 Jul 2026 23:06:27 +0200 Message-ID: <220b89a8-348e-4021-a11a-cfd73610c688@Igalia.com> Date: Mon, 13 Jul 2026 14:06:18 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 1/9] drm/managed: implement managed versions of kzalloc_obj/objs() To: Dmitry Baryshkov , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , Liviu Dudau , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org References: <20260612-wb-drop-encoder-v6-0-9f3a54f81310@oss.qualcomm.com> <20260612-wb-drop-encoder-v6-1-9f3a54f81310@oss.qualcomm.com> Content-Language: en-GB From: John Harrison In-Reply-To: <20260612-wb-drop-encoder-v6-1-9f3a54f81310@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/12/26 11:30, Dmitry Baryshkov wrote: > The kzalloc_obj() and kzalloc_objs() functions proven to be useful and > widely used for the reset of the kernel. Implement a drm_device-managed > versions of those macros to mix the nice interface with the automatic > freeing of the pointers. > > Note: the original macros accept optional GFP_foo arguments. They are > skipped for now, making all allocations use GFP_KERNEL. If necessary, > support for overriding the GFP type can be introduced later. > > Signed-off-by: Dmitry Baryshkov > --- > include/drm/drm_managed.h | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/include/drm/drm_managed.h b/include/drm/drm_managed.h > index 72d0d68be226..79049bec277d 100644 > --- a/include/drm/drm_managed.h > +++ b/include/drm/drm_managed.h > @@ -105,6 +105,28 @@ static inline void *drmm_kcalloc(struct drm_device *dev, > return drmm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); > } > > +/** > + * drmm_kzalloc_objs - &drm_device-managed kzalloc_objs() > + * @dev: DRM device > + * @p: Variable or type to allocate an array of > + * @count: How many elements in the array > + * > + * Returns: newly allocated pointer to the zeroed array of @P on success, or There is a mix of p and P going on here. With this made more consistent: Reviewed-by: John Harrison > + * NULL on failure. > + */ > +#define drmm_kzalloc_objs(dev, p, count) \ > + drmm_kcalloc(dev, count, sizeof(typeof(p)), GFP_KERNEL) > + > +/** > + * drmm_kzalloc_obj - &drm_device-managed kzalloc_obj() > + * @dev: DRM device > + * @p: Variable or type to allocate > + * > + * Returns: newly allocated pointer to a @p on success, or NULL on failure. > + */ > +#define drmm_kzalloc_obj(dev, P) \ > + drmm_kzalloc_objs(dev, P, 1) > + > char *drmm_kstrdup(struct drm_device *dev, const char *s, gfp_t gfp); > > void drmm_kfree(struct drm_device *dev, void *data); >