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=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 DF29AC433DB for ; Wed, 17 Mar 2021 11:34:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9809264F10 for ; Wed, 17 Mar 2021 11:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231445AbhCQLeO (ORCPT ); Wed, 17 Mar 2021 07:34:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24685 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbhCQLdo (ORCPT ); Wed, 17 Mar 2021 07:33:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615980824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aAnF1vYY3gBdcvWdXcgN/3PXukv2xlMHhVBn3KTxPzY=; b=Fe6trW2tEh1RdWQZ63LzEqjuUJZRW8nInSedGu5KlOJ6YOAwpKIYwTx1f7+oHQu10hiN0D LTt+SrF5YECPkbz1Se9zFB0aM97VtS4+eebCfS+EnhvjYmlnnE48wJUleAkRT0v53mV6KO kaGTdlX6Uitex1UYxmiC2xNX/07Dw54= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-1kXcIWkRPBSJBBrTVqqDhg-1; Wed, 17 Mar 2021 07:33:40 -0400 X-MC-Unique: 1kXcIWkRPBSJBBrTVqqDhg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51B9E91152; Wed, 17 Mar 2021 11:33:38 +0000 (UTC) Received: from gondolin (ovpn-113-255.ams2.redhat.com [10.36.113.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id D75F55D747; Wed, 17 Mar 2021 11:33:34 +0000 (UTC) Date: Wed, 17 Mar 2021 12:33:32 +0100 From: Cornelia Huck To: Jason Gunthorpe Cc: Alex Williamson , Jonathan Corbet , Diana Craciun , Eric Auger , kvm@vger.kernel.org, Kirti Wankhede , linux-doc@vger.kernel.org, "Raj, Ashok" , Dan Williams , Daniel Vetter , Christoph Hellwig , Leon Romanovsky , Max Gurtovoy , Tarun Gupta Subject: Re: [PATCH v2 12/14] vfio: Make vfio_device_ops pass a 'struct vfio_device *' instead of 'void *' Message-ID: <20210317123332.7ab93789.cohuck@redhat.com> In-Reply-To: <12-v2-20d933792272+4ff-vfio1_jgg@nvidia.com> References: <0-v2-20d933792272+4ff-vfio1_jgg@nvidia.com> <12-v2-20d933792272+4ff-vfio1_jgg@nvidia.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri, 12 Mar 2021 20:56:04 -0400 Jason Gunthorpe wrote: > This is the standard kernel pattern, the ops associated with a struct get > the struct pointer in for typesafety. The expected design is to use > container_of to cleanly go from the subsystem level type to the driver > level type without having any type erasure in a void *. > > Reviewed-by: Dan Williams > Signed-off-by: Jason Gunthorpe > --- > Documentation/driver-api/vfio.rst | 18 ++++---- > drivers/vfio/fsl-mc/vfio_fsl_mc.c | 36 +++++++++------ > drivers/vfio/mdev/vfio_mdev.c | 33 +++++++------- > drivers/vfio/pci/vfio_pci.c | 47 ++++++++++++-------- > drivers/vfio/platform/vfio_platform_common.c | 33 ++++++++------ > drivers/vfio/vfio.c | 20 ++++----- > include/linux/vfio.h | 16 +++---- > 7 files changed, 117 insertions(+), 86 deletions(-) Reviewed-by: Cornelia Huck