Received: by 10.192.165.148 with SMTP id m20csp3420332imm; Mon, 23 Apr 2018 06:21:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx48YeD9OUTcZlQ4UI2bmsp7SFrWSo+m8aBYDtwLtXPgzP1uo1ptfs9MknLHEvf8rXKJHNrO/ X-Received: by 2002:a17:902:6a10:: with SMTP id m16-v6mr20586395plk.370.1524489700685; Mon, 23 Apr 2018 06:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524489700; cv=none; d=google.com; s=arc-20160816; b=D9DC4ATMHz0ZGcYBt91BmQj67oZw5EluBx12ayl5T3PkJz+pEGwuUjh8p08jbhYj4i Pf5kXdsomVsioZrOVW/m2sVOYBANgAB8yAgkNLYMKSkNbNN6oEHw/bOyvPxsgTLQ2BCS r83k+2A+SqSAZxG5vMyOy/GgGyk6JCLegW8Yis1R+frg/WU1jMox2aUIdR6QeCw23Cdd 4D3HsOpsdFg+mP+L3uIHfy2MzkQ05s6Wj1/y7JfCBniGJVv3XNXfq9I+lCELYKXA2EnO xUE1U+EXazamGXz0CsQSV9dMNnfl5lcOCo7nE+UkU60gvWGOJixjtAnl6LdOiYdrpEsC AjAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=714xNRafEUhoaA/Ra7wjM/z2R5kY97I/RWdwegvWPwk=; b=IRqxA5mGZ7uhn5BYnd9b5zzshL5FE0vC/kh4pRhJrL9Ea1cDq2Xf8ChO8HqEi1YuJJ 0F1T4PVkFIQpBu0Oy7eRXRl+A/6XATdXK4Nq4+DjEyG5h8lE/IFGWxhnG31RdrWJ0/W0 EQKv4oaiGW7OaUuAvKJHDey0jJQunO3Uc95eQs9VBTqU4OME+o+JtNJ2Ntz34pg/mHbi 0nsiZC5qe/QNIn12yawcwTuneySLmfMp9EleLsdfivk50R89k2fqpASJIxB1pZJ6ShOh 5c2OYyGx274m97gjdyxf/EOZ3/vknIDM1Sp6eHo/oxHh1KVxCN7DgoaRVxNlPHaI8nu9 2mQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si782850pgp.632.2018.04.23.06.20.55; Mon, 23 Apr 2018 06:21:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755194AbeDWNQy (ORCPT + 99 others); Mon, 23 Apr 2018 09:16:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60782 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755144AbeDWNQy (ORCPT ); Mon, 23 Apr 2018 09:16:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 726D3CF9; Mon, 23 Apr 2018 13:16:53 +0000 (UTC) Date: Mon, 23 Apr 2018 15:16:48 +0200 From: Greg Kroah-Hartman To: NeilBrown Cc: Oleg Drokin , James Simmons , Andreas Dilger , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 08/17] staging: lustre: add container_of_safe() Message-ID: <20180423131648.GA13997@kroah.com> References: <152229732768.27689.4800156943561963977.stgit@noble> <152229760847.27689.4969508646445147289.stgit@noble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152229760847.27689.4969508646445147289.stgit@noble> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 29, 2018 at 03:26:48PM +1100, NeilBrown wrote: > Luster has a container_of0() function which is similar to > container_of() but passes an IS_ERR_OR_NULL() pointer through > unchanged. > This could be generally useful: bcache at last has a similar function. > > Naming is hard, but the precedent set by hlist_entry_safe() suggests > a _safe suffix might be most consistent. > > So add container_of_safe() to kernel.h, and replace all occurrences of > container_of0() with one of > - list_first_entry, list_next_entry, when that is a better fit, > - container_of(), when the pointer is used as a validpointer in > surrounding code, > - container_of_safe() when there is no obviously better alternative. I'm loath to add a kernel.h define for a staging driver, but this does seem sane. Nice work. greg k-h