From patchwork Wed Jun 1 10:29:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9147109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2EB660777 for ; Wed, 1 Jun 2016 10:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9668D25819 for ; Wed, 1 Jun 2016 10:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B21E2693F; Wed, 1 Jun 2016 10:29:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FC2025819 for ; Wed, 1 Jun 2016 10:29:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2ECAB6E956; Wed, 1 Jun 2016 10:29:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AD4C6E163; Wed, 1 Jun 2016 10:29:15 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 60396803-1500048 for multiple; Wed, 01 Jun 2016 11:29:26 +0100 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Wed, 01 Jun 2016 11:29:12 +0100 Date: Wed, 1 Jun 2016 11:29:12 +0100 From: Chris Wilson To: Daniel Vetter Subject: Re: [PATCH v2 01/21] drm: Export drm_dev_init() for subclassing Message-ID: <20160601102912.GF10319@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Daniel Vetter , intel-gfx@lists.freedesktop.org, Daniel Vetter , dri-devel@lists.freedesktop.org References: <1464597519-16659-1-git-send-email-chris@chris-wilson.co.uk> <1464597519-16659-2-git-send-email-chris@chris-wilson.co.uk> <20160601100144.GU7231@phenom.ffwll.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160601100144.GU7231@phenom.ffwll.local> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jun 01, 2016 at 12:01:44PM +0200, Daniel Vetter wrote: > With the one bug in the error handling fixed, and the kerneldoc augmented: > Reviewed-by: Daniel Vetter Thanks, nice catch for err_minors. -Chris diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index f0553ccd4f71..4f3d3bba08f7 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -565,6 +565,9 @@ static void drm_fs_inode_free(struct inode *inode) * * Note that for purely virtual devices @parent can be NULL. * + * Drivers that do not want to allocate their own device struct + * embedding struct &drm_device can call drm_dev_alloc() instead. + * * RETURNS: * 0 on success, or error code on failure. */ @@ -616,7 +619,8 @@ int drm_dev_init(struct drm_device *dev, if (ret) goto err_minors; - if (drm_ht_create(&dev->map_hash, 12)) + ret = drm_ht_create(&dev->map_hash, 12); + if (ret) goto err_minors; drm_legacy_ctxbitmap_init(dev); @@ -670,6 +674,9 @@ EXPORT_SYMBOL(drm_dev_init); * * Note that for purely virtual devices @parent can be NULL. * + * Drivers that wish to subclass or embed struct &drm_device into their + * own struct should look at using drm_dev_init() instead. + * * RETURNS: * Pointer to new DRM device, or NULL if out of memory. */