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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 DAD55C433DF for ; Fri, 21 Aug 2020 08:37:34 +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 A404B207DA for ; Fri, 21 Aug 2020 08:37:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="icYnWpDJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A404B207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iVBnoEbetz+5aAsYZayz8g7g8VOCAS96paB35oe0GRI=; b=icYnWpDJQbrMvoYGlhp1Ofk5b 41Ka0nwGYVI9DzhbFeROE9+z+yw1ib+Z8759qpEg3HPBALV7rDLI79pcFwbU7Q0Wt+G8/qhbzBvEA dGaydjQ+mp7zS17asn5n0kMoeY4/vQ6Jul9QSaTrqxmcviKBnCVxrBf7sfkvKOvOZCQZlL2V2oXig 0ClOmO3DHnu/yf8lN8ZT/+HMRKnZMAAL4nVgmufBXHPtt0wqkx+zgvv6StizEw4Ko3NIL0w531cf5 NdwOeC0rzq5hciYQkLSJvB5V2OoH9tAyxufH5IefGL4iU795wiM1mKLAjxDGGyJGJ9WRMYFhIfbMg RW1O22T3w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k92WW-0006bT-HV; Fri, 21 Aug 2020 08:35:44 +0000 Received: from mga14.intel.com ([192.55.52.115]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k92WT-0006ao-Dk for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 08:35:42 +0000 IronPort-SDR: 8hQiSpPrWFMTGSZoMhSnz5gU8wYABVxcSwjBgt9UkPhHE9wgCq64FyL7X0s9WSs+fPiYzRaTWq WUI8Kmd+mwhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9719"; a="154757953" X-IronPort-AV: E=Sophos;i="5.76,335,1592895600"; d="scan'208";a="154757953" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2020 01:35:39 -0700 IronPort-SDR: kPINq9ixWXyPpch7brhxnjMiBn6ePSw4V+gQnwsz0I5/NakVFttvyHIM9Z+bHNE0Nqf18ENI3v F+cuKaXVHgOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,335,1592895600"; d="scan'208";a="327705621" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008.jf.intel.com with ESMTP; 21 Aug 2020 01:35:35 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1k92DL-00AI66-Dw; Fri, 21 Aug 2020 11:15:55 +0300 Date: Fri, 21 Aug 2020 11:15:55 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Subject: Re: [PATCH v8 1/3] devres: provide devm_krealloc() Message-ID: <20200821081555.GG1891694@smile.fi.intel.com> References: <20200820185110.17828-1-brgl@bgdev.pl> <20200820185110.17828-2-brgl@bgdev.pl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200820185110.17828-2-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_043541_630885_A1C0EF68 X-CRM114-Status: GOOD ( 15.09 ) 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: linux-arm-kernel@lists.infradead.org, Lars-Peter Clausen , linux-iio@vger.kernel.org, Greg Kroah-Hartman , Michal Simek , linux-kernel@vger.kernel.org, Bartosz Golaszewski , Guenter Roeck , Peter Meerwald-Stadler , Hartmut Knaack , Jonathan Cameron 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 08:51:08PM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Implement the managed variant of krealloc(). This function works with > all memory allocated by devm_kmalloc() (or devres functions using it > implicitly like devm_kmemdup(), devm_kstrdup() etc.). > > Managed realloc'ed chunks can be manually released with devm_kfree(). > > Signed-off-by: Bartosz Golaszewski > Reviewed-by: Andy Shevchenko ... > +static struct devres *to_devres(void *data) > +{ > + return data - ALIGN(sizeof(struct devres), ARCH_KMALLOC_MINALIGN); > +} > + > +static size_t devres_data_size(size_t total_size) > +{ > + return total_size - ALIGN(sizeof(struct devres), ARCH_KMALLOC_MINALIGN); > +} I'm fine with above, but here is a side note, perhaps offsetof(struct devres, data) will be more practical (no duplication of alignment and hence slightly better maintenance)? (Note, I didn't check if it provides the correct result) Another side note: do we have existing users of these helpers? -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel