From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A70FC433E1 for ; Thu, 23 Jul 2020 14:46:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 367F720768 for ; Thu, 23 Jul 2020 14:46:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 367F720768 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF3C66E17D; Thu, 23 Jul 2020 14:46:40 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4BCF6E0E2 for ; Thu, 23 Jul 2020 14:46:39 +0000 (UTC) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jycUX-0006B6-UH; Thu, 23 Jul 2020 16:46:37 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1jycUX-0000v0-Dj; Thu, 23 Jul 2020 16:46:37 +0200 Message-ID: Subject: Re: [PATCH] drm/simple_kms_helper: add drmm_simple_encoder_init() From: Philipp Zabel To: daniel@ffwll.ch Date: Thu, 23 Jul 2020 16:46:37 +0200 In-Reply-To: <20200722222243.GM6419@phenom.ffwll.local> References: <20200722132558.28289-1-p.zabel@pengutronix.de> <34224c32-7c17-4c7e-1ec9-03215ec7ed8a@suse.de> <20200722222243.GM6419@phenom.ffwll.local> User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@pengutronix.de, dri-devel@lists.freedesktop.org, Thomas Zimmermann Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Daniel, On Thu, 2020-07-23 at 00:22 +0200, daniel@ffwll.ch wrote: [...] > Yeah the drmm_ versions of these need to check that the ->cleanup hook is > NULL. > > Also there's not actually a double-free, since drm_foo_cleanup removes it > from the lists, which means drm_mode_config_cleanup won't even see it. But > if the driver has some additional code in ->cleanup that won't ever run, > so probably still a bug. > > I also think that the drmm_foo_ wrappers should also do the allocation > (and upcasting) kinda like drmm_dev_alloc(). Otherwise we're still stuck > with tons of boilerplate. Ok, I'll try this: drmm_encoder_init() variant can verify that the passed drm_encoder_funcs::destroy hook is NULL. drmm_simple_encoder_init() can just provide empty drm_encoder_funcs internally. > For now I think it's ok if drivers that switch to drmm_ just copypaste, > until we're sure this is the right thing to do. And then maybe also roll > these out for all objects that stay for the entire lifetime of drm_device > (plane, crtc, encoder, plus variants). Just to make sure we're consistent > across all of them. Thank you for clarifying, I wasn't sure this was the goal. I've started with this function mostly because this is the most used one in imx-drm and the only one where I didn't have to deal with va_args boilerplate. regards Philipp _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel