From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com. [2a00:1450:4864:20::443]) by gmr-mx.google.com with ESMTPS id w127si38607wmg.1.2020.08.25.18.51.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Aug 2020 18:51:47 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id q14so154071wrn.9 for ; Tue, 25 Aug 2020 18:51:47 -0700 (PDT) MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API Content-Type: text/plain; charset="UTF-8" To: James Bottomley Cc: Allen , Jens Axboe , Kees Cook , jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com, 3chas3@gmail.com, stefanr@s5r6.in-berlin.de, airlied@linux.ie, Daniel Vetter , sre@kernel.org, kys@microsoft.com, deller@gmx.de, dmitry.torokhov@gmail.com, jassisinghbrar@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, maximlevitsky@gmail.com, oakad@yahoo.com, Ulf Hansson , mporter@kernel.crashing.org, alex.bou9@gmail.com, broonie@kernel.org, martyn@welchs.me.uk, manohar.vanga@gmail.com, mitch@sfgoth.com, David Miller , Jakub Kicinski , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-block@vger.kernel.org, linux-arm-kernel@lists.infradead.org, openipmi-developer@lists.sourceforge.net, linux1394-devel@lists.sourceforge.net, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org, linux-parisc@vger.kernel.org, linux-input@vger.kernel.org, linux-mmc@vger.kernel.org, linux-ntb@googlegroups.com, linux-s390@vger.kernel.org, linux-spi@vger.kernel.org, devel@driverdev.osuosl.org, Romain Perier List-ID: On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. 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=-3.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 0A140C433E4 for ; Wed, 26 Aug 2020 01:51:53 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 D2717206E3 for ; Wed, 26 Aug 2020 01:51:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rkPU8zA6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2717206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9C31187E4C; Wed, 26 Aug 2020 01:51:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hAeMR4Gyl+vT; Wed, 26 Aug 2020 01:51:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 1840687A62; Wed, 26 Aug 2020 01:51:52 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 4AABD1BF2A0 for ; Wed, 26 Aug 2020 01:51:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 463D687A56 for ; Wed, 26 Aug 2020 01:51:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yM7SWBuTLrX0 for ; Wed, 26 Aug 2020 01:51:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by hemlock.osuosl.org (Postfix) with ESMTPS id 6A28A87A4F for ; Wed, 26 Aug 2020 01:51:48 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id p17so158475wrj.8 for ; Tue, 25 Aug 2020 18:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=rkPU8zA6FnvPI7YRdwlrF32Z+jufZRPGDhsVbublBxI+2WdfyrQZ4OMYugj2LjMgRs tcBC2iVxYnWeg8Zk6YWzQfE0csZvqLsQKSxRKrpJnxvpSdJ9HVsaxBuVVCZ33a7Fy89F YzL00nv71TEx1KwJewv+LaAx654GeLawZ3dB08BJtkewTW0RxdimmA59/2c32/oJxdK5 dSKP0GfmMvAUQJfWlO1JkSN5McliJO+sig5zbM32H0/Kuj9D+O0+2QWE9ikcOBAgMoCE knF+3yVSHzD+dH7rwDtBk3Dij3c2i2NaVRbX/WHThEgypBISYgNE6EdHQjalStrd+n7R ERAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=c2FcA3YRpihOIi7+leixtOz6ZoMvlcRQxjwBdea5g/pnbvgrPGhcrUFR3ngIQEBz2k B40BTY5pd4lKB5D2YadTn34Uc9i3Yf4WZfi01phGNdcHl2pR2X9we+pT0FMUupTjpRWv izI3J8IsvsAnO1khS0nCK/yMZwkiFExuYAG9A2Tb8n5Vh5eB5zxD43IyOWfUyJVSqsqo DjhdXxOHk0s1P2E63LwKIAhnoZMoQL7eqyMX5Fo3GMi5MIjJq7DwxSPXZxOxkykXpGvY AnR6HqNDkMsqK66acjrfpPRxbP8oWsDjGbG+lKokZAdGdBvS8IDGKRuA0XP8UMswscQK jqYw== X-Gm-Message-State: AOAM531BTGb2USx2V5DpEEkSbsuYiQa/E+sxTtHSYXbzNED2QyGKwLQt Wx7IaWi7KP3yR89uoZAfYFzseO0SHECMBfqDVUI= X-Google-Smtp-Source: ABdhPJyeqlKj5YPc50Em7rO4ODLMTr2DC/m+jfMJDMOpF+XoOI2kKLAaJQ+LNrc4dhPoiuNEDU0+R/Ls8lv1xf0wUss= X-Received: by 2002:adf:db43:: with SMTP id f3mr14164955wrj.219.1598406706678; Tue, 25 Aug 2020 18:51:46 -0700 (PDT) MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API To: James Bottomley X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , linux-atm-general@lists.sourceforge.net, manohar.vanga@gmail.com, airlied@linux.ie, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, sre@kernel.org, anton.ivanov@cambridgegreys.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux1394-devel@lists.sourceforge.net, maximlevitsky@gmail.com, richard@nod.at, deller@gmx.de, jassisinghbrar@gmail.com, linux-spi@vger.kernel.org, 3chas3@gmail.com, intel-gfx@lists.freedesktop.org, Jakub Kicinski , mporter@kernel.crashing.org, jdike@addtoit.com, Kees Cook , oakad@yahoo.com, s.hauer@pengutronix.de, linux-input@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, broonie@kernel.org, openipmi-developer@lists.sourceforge.net, mitch@sfgoth.com, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, martyn@welchs.me.uk, dmitry.torokhov@gmail.com, linux-mmc@vger.kernel.org, Allen , linux-kernel@vger.kernel.org, alex.bou9@gmail.com, stefanr@s5r6.in-berlin.de, Daniel Vetter , linux-ntb@googlegroups.com, Romain Perier , shawnguo@kernel.org, David Miller Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel 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=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 90A0BC433E1 for ; Wed, 26 Aug 2020 01:54:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 50024206E3 for ; Wed, 26 Aug 2020 01:54:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0BT9yld5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rkPU8zA6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50024206E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NdZk9qywWIAiEeuPh/cL/tRfR0laRDEcr1a9JUe615E=; b=0BT9yld5M0VR4/BlGbtCJx9AW lCkV8NgIJJ6Gr1jwVxyvgCbklsY8WeY+vemNQ+dF9ZPs6WXqg1BXC3I9UCvg+Z7Ng8dWAL4uCLErF PgyKjZayxgXhCdnGOgCSS5GeLoBe15EwRobxzJIWbH7VUJfyWLiO4PQDMofdLWGsL+6DI83bbgnMJ t9NKAqF8segJpwbE6X5vRFoSIC32IA1O2U1i/dnbhFjs5IiOv4atdKNTe5J4TYqA/fX7jYP0+J+cc FLpemE99YFl+xG+D0Jg1E2y9SmXxA6Hub2YxXsDbJu3AxHgP3cgHEmD9xz4KPSAmjI/dZuHhe+sTY NTnqyrWrg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAkbT-0001s2-Ex; Wed, 26 Aug 2020 01:51:55 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAkbP-0001q8-I1; Wed, 26 Aug 2020 01:51:52 +0000 Received: by mail-wr1-x443.google.com with SMTP id c15so147588wrs.11; Tue, 25 Aug 2020 18:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=rkPU8zA6FnvPI7YRdwlrF32Z+jufZRPGDhsVbublBxI+2WdfyrQZ4OMYugj2LjMgRs tcBC2iVxYnWeg8Zk6YWzQfE0csZvqLsQKSxRKrpJnxvpSdJ9HVsaxBuVVCZ33a7Fy89F YzL00nv71TEx1KwJewv+LaAx654GeLawZ3dB08BJtkewTW0RxdimmA59/2c32/oJxdK5 dSKP0GfmMvAUQJfWlO1JkSN5McliJO+sig5zbM32H0/Kuj9D+O0+2QWE9ikcOBAgMoCE knF+3yVSHzD+dH7rwDtBk3Dij3c2i2NaVRbX/WHThEgypBISYgNE6EdHQjalStrd+n7R ERAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=ktcwPmIvI0mw3ryEtyMrjuHPoRe+HxlqfEGHIHPv21O4b1Ax4oMwhvI8MIm0vKjZXc 2nRdxyaFW95NR1zIuRJiiNZk96YLulyZcTMhd4TafYd4+gx0V9aZ5PaPM0rWcIYl8pQR bUaw38bVYragrOWIlGeT5h8Y8kR0uhVbi/9iz8Vc4nj6KsY83q/B4lYRkejeSQLkeJzw eiN6DBW52rxZVgqoTN6s6BIpJiqEqPFqwIr8ExDRZCQj4tUQUPyu9mIfHqut6eS2L/KH NsR9dM1NWIfMB5h3oSFX4yf+6pxT53KTBMEz1b/GSwdIakaDaHt+e2/E5vfgIRnWaaK8 GGrw== X-Gm-Message-State: AOAM531apQ4P1KttOWr5Gwv8UIPJiiZKhoKXynphaXnucOlB8wZAEEk/ wfwLNQ6AfJ0edtwKcMwVf3DnXIN1jpxvk+q47z8= X-Google-Smtp-Source: ABdhPJyeqlKj5YPc50Em7rO4ODLMTr2DC/m+jfMJDMOpF+XoOI2kKLAaJQ+LNrc4dhPoiuNEDU0+R/Ls8lv1xf0wUss= X-Received: by 2002:adf:db43:: with SMTP id f3mr14164955wrj.219.1598406706678; Tue, 25 Aug 2020 18:51:46 -0700 (PDT) MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API To: James Bottomley X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200825_215151_627133_141676C5 X-CRM114-Status: GOOD ( 29.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , linux-atm-general@lists.sourceforge.net, manohar.vanga@gmail.com, airlied@linux.ie, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, sre@kernel.org, kys@microsoft.com, anton.ivanov@cambridgegreys.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux1394-devel@lists.sourceforge.net, maximlevitsky@gmail.com, richard@nod.at, deller@gmx.de, jassisinghbrar@gmail.com, linux-spi@vger.kernel.org, 3chas3@gmail.com, intel-gfx@lists.freedesktop.org, Jakub Kicinski , mporter@kernel.crashing.org, jdike@addtoit.com, Kees Cook , oakad@yahoo.com, s.hauer@pengutronix.de, linux-input@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, broonie@kernel.org, openipmi-developer@lists.sourceforge.net, mitch@sfgoth.com, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, martyn@welchs.me.uk, dmitry.torokhov@gmail.com, linux-mmc@vger.kernel.org, Allen , linux-kernel@vger.kernel.org, alex.bou9@gmail.com, stefanr@s5r6.in-berlin.de, Daniel Vetter , linux-ntb@googlegroups.com, Romain Perier , shawnguo@kernel.org, David Miller Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-3.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B1D91C433DF for ; Wed, 26 Aug 2020 08:05:54 +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 7D74B20866 for ; Wed, 26 Aug 2020 08:05:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rkPU8zA6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D74B20866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 A0D6A894DD; Wed, 26 Aug 2020 08:05:52 +0000 (UTC) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 242E06E9EE; Wed, 26 Aug 2020 01:51:48 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id a5so163729wrm.6; Tue, 25 Aug 2020 18:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=rkPU8zA6FnvPI7YRdwlrF32Z+jufZRPGDhsVbublBxI+2WdfyrQZ4OMYugj2LjMgRs tcBC2iVxYnWeg8Zk6YWzQfE0csZvqLsQKSxRKrpJnxvpSdJ9HVsaxBuVVCZ33a7Fy89F YzL00nv71TEx1KwJewv+LaAx654GeLawZ3dB08BJtkewTW0RxdimmA59/2c32/oJxdK5 dSKP0GfmMvAUQJfWlO1JkSN5McliJO+sig5zbM32H0/Kuj9D+O0+2QWE9ikcOBAgMoCE knF+3yVSHzD+dH7rwDtBk3Dij3c2i2NaVRbX/WHThEgypBISYgNE6EdHQjalStrd+n7R ERAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=Jir5oU4JYAc/XwzFornCF+JetY+nb0W9W/2VK191K3ybnniVSatqirM8g3123gXWU7 gbDq1VhNYDde/t6awFAGHqnXD+0OJzCuy7ScZJltJgAhFppedpQoz3QRe6WUNvdcdotT RrLX53clzORfON5s0osb5i17uumyV87qyHKJ/I826erHD4mbnx08XB4kGSqmF3Hoj4Qh hAdeCwj45X2ARPmBmx+wfTbBLTSZ57uk6UjOLb94ADnQH4VRkVE9bccuz2b7MB2cemij cefWQVL3N4bUgDFduU82yvb2Ul0JiXxYmPj++glmd2EZNxNB70dZsbruAT96LVgRXv2D W17g== X-Gm-Message-State: AOAM531h1I51DHsvyKU3cRxxTFTeEouXdDYdtOICUXnc7L/neGNsCmTz WJxKNqMpDWc1UStY+6JCj6PGiUCzefDMLvIEKtE= X-Google-Smtp-Source: ABdhPJyeqlKj5YPc50Em7rO4ODLMTr2DC/m+jfMJDMOpF+XoOI2kKLAaJQ+LNrc4dhPoiuNEDU0+R/Ls8lv1xf0wUss= X-Received: by 2002:adf:db43:: with SMTP id f3mr14164955wrj.219.1598406706678; Tue, 25 Aug 2020 18:51:46 -0700 (PDT) MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API To: James Bottomley X-Mailman-Approved-At: Wed, 26 Aug 2020 08:04:49 +0000 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: Ulf Hansson , linux-atm-general@lists.sourceforge.net, manohar.vanga@gmail.com, airlied@linux.ie, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, sre@kernel.org, kys@microsoft.com, anton.ivanov@cambridgegreys.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux1394-devel@lists.sourceforge.net, maximlevitsky@gmail.com, richard@nod.at, deller@gmx.de, jassisinghbrar@gmail.com, linux-spi@vger.kernel.org, 3chas3@gmail.com, intel-gfx@lists.freedesktop.org, Jakub Kicinski , mporter@kernel.crashing.org, jdike@addtoit.com, Kees Cook , oakad@yahoo.com, s.hauer@pengutronix.de, linux-input@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, broonie@kernel.org, openipmi-developer@lists.sourceforge.net, mitch@sfgoth.com, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, martyn@welchs.me.uk, dmitry.torokhov@gmail.com, linux-mmc@vger.kernel.org, Allen , linux-kernel@vger.kernel.org, alex.bou9@gmail.com, stefanr@s5r6.in-berlin.de, linux-ntb@googlegroups.com, Romain Perier , shawnguo@kernel.org, David Miller Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-3.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 3E36AC433E1 for ; Wed, 26 Aug 2020 13:18:18 +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 0CDE62080C for ; Wed, 26 Aug 2020 13:18:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rkPU8zA6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CDE62080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CF046E134; Wed, 26 Aug 2020 13:18:17 +0000 (UTC) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 242E06E9EE; Wed, 26 Aug 2020 01:51:48 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id a5so163729wrm.6; Tue, 25 Aug 2020 18:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=rkPU8zA6FnvPI7YRdwlrF32Z+jufZRPGDhsVbublBxI+2WdfyrQZ4OMYugj2LjMgRs tcBC2iVxYnWeg8Zk6YWzQfE0csZvqLsQKSxRKrpJnxvpSdJ9HVsaxBuVVCZ33a7Fy89F YzL00nv71TEx1KwJewv+LaAx654GeLawZ3dB08BJtkewTW0RxdimmA59/2c32/oJxdK5 dSKP0GfmMvAUQJfWlO1JkSN5McliJO+sig5zbM32H0/Kuj9D+O0+2QWE9ikcOBAgMoCE knF+3yVSHzD+dH7rwDtBk3Dij3c2i2NaVRbX/WHThEgypBISYgNE6EdHQjalStrd+n7R ERAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6lKBXswTrzhA0xBsr6HB8AlB5+bACM8/QHtln5EsmDM=; b=Jir5oU4JYAc/XwzFornCF+JetY+nb0W9W/2VK191K3ybnniVSatqirM8g3123gXWU7 gbDq1VhNYDde/t6awFAGHqnXD+0OJzCuy7ScZJltJgAhFppedpQoz3QRe6WUNvdcdotT RrLX53clzORfON5s0osb5i17uumyV87qyHKJ/I826erHD4mbnx08XB4kGSqmF3Hoj4Qh hAdeCwj45X2ARPmBmx+wfTbBLTSZ57uk6UjOLb94ADnQH4VRkVE9bccuz2b7MB2cemij cefWQVL3N4bUgDFduU82yvb2Ul0JiXxYmPj++glmd2EZNxNB70dZsbruAT96LVgRXv2D W17g== X-Gm-Message-State: AOAM531h1I51DHsvyKU3cRxxTFTeEouXdDYdtOICUXnc7L/neGNsCmTz WJxKNqMpDWc1UStY+6JCj6PGiUCzefDMLvIEKtE= X-Google-Smtp-Source: ABdhPJyeqlKj5YPc50Em7rO4ODLMTr2DC/m+jfMJDMOpF+XoOI2kKLAaJQ+LNrc4dhPoiuNEDU0+R/Ls8lv1xf0wUss= X-Received: by 2002:adf:db43:: with SMTP id f3mr14164955wrj.219.1598406706678; Tue, 25 Aug 2020 18:51:46 -0700 (PDT) MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: To: James Bottomley X-Mailman-Approved-At: Wed, 26 Aug 2020 13:18:16 +0000 Subject: Re: [Intel-gfx] [PATCH] block: convert tasklets to use new tasklet_setup() API X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , linux-atm-general@lists.sourceforge.net, manohar.vanga@gmail.com, airlied@linux.ie, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, sre@kernel.org, kys@microsoft.com, anton.ivanov@cambridgegreys.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux1394-devel@lists.sourceforge.net, maximlevitsky@gmail.com, richard@nod.at, deller@gmx.de, jassisinghbrar@gmail.com, linux-spi@vger.kernel.org, 3chas3@gmail.com, intel-gfx@lists.freedesktop.org, Jakub Kicinski , mporter@kernel.crashing.org, jdike@addtoit.com, Kees Cook , oakad@yahoo.com, s.hauer@pengutronix.de, linux-input@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, broonie@kernel.org, openipmi-developer@lists.sourceforge.net, mitch@sfgoth.com, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, martyn@welchs.me.uk, dmitry.torokhov@gmail.com, linux-mmc@vger.kernel.org, Allen , linux-kernel@vger.kernel.org, alex.bou9@gmail.com, stefanr@s5r6.in-berlin.de, linux-ntb@googlegroups.com, Romain Perier , shawnguo@kernel.org, David Miller Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 References: <20200817091617.28119-1-allen.cryptic@gmail.com> <20200817091617.28119-2-allen.cryptic@gmail.com> <202008171228.29E6B3BB@keescook> <161b75f1-4e88-dcdf-42e8-b22504d7525c@kernel.dk> <202008171246.80287CDCA@keescook> <1597780833.3978.3.camel@HansenPartnership.com> <1597849185.3875.7.camel@HansenPartnership.com> <1597873172.4030.2.camel@HansenPartnership.com> In-Reply-To: <1597873172.4030.2.camel@HansenPartnership.com> From: Allen Pais Date: Wed, 26 Aug 2020 07:21:35 +0530 Message-ID: Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: James Bottomley Cc: Ulf Hansson , linux-atm-general@lists.sourceforge.net, manohar.vanga@gmail.com, airlied@linux.ie, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, sre@kernel.org, kys@microsoft.com, anton.ivanov@cambridgegreys.com, devel@driverdev.osuosl.org, linux-s390@vger.kernel.org, linux1394-devel@lists.sourceforge.net, maximlevitsky@gmail.com, richard@nod.at, deller@gmx.de, jassisinghbrar@gmail.com, linux-spi@vger.kernel.org, 3chas3@gmail.com, intel-gfx@lists.freedesktop.org, Jakub Kicinski , mporter@kernel.crashing.org, jdike@addtoit.com, Kees Cook , oakad@yahoo.com, s.hauer@pengutronix.de, linux-input@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, broonie@kernel.org, openipmi-developer@lists.sourceforge.net, mitch@sfgoth.com, linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-parisc@vger.kernel.org, netdev@vger.kernel.org, martyn@welchs.me.uk, dmitry.torokhov@gmail.com, linux-mmc@vger.kernel.org, Allen , linux-kernel@vger.kernel.org, alex.bou9@gmail.com, stefanr@s5r6.in-berlin.de, Daniel Vetter , linux-ntb@googlegroups.com, Romain Perier , shawnguo@kernel.org, David Miller On Thu, Aug 20, 2020 at 3:09 AM James Bottomley wrote: > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote: > > > [...] > > > > > Since both threads seem to have petered out, let me suggest in > > > > > kernel.h: > > > > > > > > > > #define cast_out(ptr, container, member) \ > > > > > container_of(ptr, typeof(*container), member) > > > > > > > > > > It does what you want, the argument order is the same as > > > > > container_of with the only difference being you name the > > > > > containing structure instead of having to specify its type. > > > > > > > > Not to incessantly bike shed on the naming, but I don't like > > > > cast_out, it's not very descriptive. And it has connotations of > > > > getting rid of something, which isn't really true. > > > > > > Um, I thought it was exactly descriptive: you're casting to the > > > outer container. I thought about following the C++ dynamic casting > > > style, so out_cast(), but that seemed a bit pejorative. What about > > > outer_cast()? > > > > > > > FWIW, I like the from_ part of the original naming, as it has > > > > some clues as to what is being done here. Why not just > > > > from_container()? That should immediately tell people what it > > > > does without having to look up the implementation, even before > > > > this becomes a part of the accepted coding norm. > > > > > > I'm not opposed to container_from() but it seems a little less > > > descriptive than outer_cast() but I don't really care. I always > > > have to look up container_of() when I'm using it so this would just > > > be another macro of that type ... > > > > > > > So far we have a few which have been suggested as replacement > > for from_tasklet() > > > > - out_cast() or outer_cast() > > - from_member(). > > - container_from() or from_container() > > > > from_container() sounds fine, would trimming it a bit work? like > > from_cont(). > > I'm fine with container_from(). It's the same form as container_of() > and I think we need urgent agreement to not stall everything else so > the most innocuous name is likely to get the widest acceptance. Kees, Will you be sending the newly proposed API to Linus? I have V2 which uses container_from() ready to be sent out. Thanks. _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um