Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1059174imm; Wed, 23 May 2018 09:36:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqQ1wWVutkUteYT9RK6TJXCgs8APXJyBQPxFpXhMI7/qdE3kYFpISyC6UMLC2JUxQFAG+wO X-Received: by 2002:aa7:828c:: with SMTP id s12-v6mr3584899pfm.136.1527093395645; Wed, 23 May 2018 09:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527093395; cv=none; d=google.com; s=arc-20160816; b=iAblnFGeEWEsxffIAtpLXhiroJzpvCg3N2so6EJ+HRaCIwqZ39tNqnDvrjCzGlLRqX fXjy7A8gBq3BVqvCHzUNDsWVEWLUtFoGgeHO5wIQqmXRf8rsKhm9T4ZXvyloaYi/6GBn aGnajbSic1ITCnUgQSNcHffgjHQLhOg15OCd3BmMgr7LqE2uwspz+t0nGUEc9bCml0ha w/kQgfkso3/l309Qd0e1VTxXvNNmDlqF1sZfmn3JeyiT3GPKpUUWfZgHTK1o7VaQ6KUF fgWENJLMmxlYCWFGc0iU81/nFx6tYsZ6eJkYpV1A4ZQKmwRt4Q1O2Qbx7zdwNXKEi3pE 8CoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Aev//B/xKfVZezuqNH0OKFMPZTvUEZq3jXhUhuaAqcs=; b=EH2gE0WxF54X8wpelHKF+hwtOpotRN0CF/LJG1LCKS9BBDNJd+paVk4u9wSN0qlUOt HhSKXMrAViEuRhbUYVAYijlCL31vOFFn/TilngHqiwIqJACKTZaEucH8hcsUJb864ubb cXwQPS2Nx8LZSNbPKpK89vT9bYwZPrRE88PeK4V10/6rSnQmXCRqhIR/VJfBKgfohVUq TNX0g0plQqeEIrAgImLf+0TnKbK7kOLrvognQasGxKx9lk5jLswMbgKkL5DCrBR0Ofj3 iamTm/+9AlpfnSjA8jCGnQVaGOuVRHGI2Lqfz7yIWPVrs5yEZC/LplX/zYXtErZhWvKX u/Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t7SroeHd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q192-v6si19561666pfq.307.2018.05.23.09.36.20; Wed, 23 May 2018 09:36:35 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t7SroeHd; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754779AbeEWQf6 (ORCPT + 99 others); Wed, 23 May 2018 12:35:58 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:41865 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754623AbeEWQfx (ORCPT ); Wed, 23 May 2018 12:35:53 -0400 Received: by mail-qk0-f194.google.com with SMTP id d125-v6so17945584qkb.8 for ; Wed, 23 May 2018 09:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Aev//B/xKfVZezuqNH0OKFMPZTvUEZq3jXhUhuaAqcs=; b=t7SroeHd34FTYCbpY41pfAkeQo3lA5io0cuQZCMA4/Hr7mHgIy2VqIJMEbGoORjEbV DFfDVS+nrVLD3Hk7U3Vn3pBTP2VtkCN7tnA+egFNFRBUtfS2Nxjlq8w2GtlmgZVjwTMF zVEa0lDEzBzKhm6R/GCmrbWpChbg+M0KqaXIkbZoflMHOostovIBkB+qugQibDTLTWZT 9j81hYrouAkZ8OWgC+Cl5VV7eX+mDkaMe4x//Jd2OnaT3xfW4ck5GaAsrEN4StJxJ+Vr vAhRttvb4R+JPEDscyta5a/EUqc7ctzGuznNRdpf0jFyL7ojJorJAWGgU4SywaVmOSSw GwxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Aev//B/xKfVZezuqNH0OKFMPZTvUEZq3jXhUhuaAqcs=; b=JHd0vYo4+jSm+79trehpp9pCcxQjjTJGW437J+b1Zxt7YTe75pXNfn2YxLMKMHKxSj +1MfehJgtv4CRpotBs2p1692yPHc2VlCded+xezsupktjbbb9efyYP3GdM6ngMQX8yk+ giwIOOAOhLJBTIpLm88qTWW/MkKD6ljiYSQrtXU4/BOjc+8pliETeSH4duRPNCqQbQmc Za/TVwJ9W8ezH5x1uOrah5rK3tA0DB8WvLU62HbkRj330sLthQhPhuvIHpUpDP3GVMZZ bTqms+/NHMwN4zJCglVyBxD3Cb24neycYTaHCrcCYcyw/AJ6gnLME67+vlxUFaHkY/rL uAyg== X-Gm-Message-State: ALKqPweJOes37HNDHA8Ge1yeNm8X/loNrpgH0RsDmgooORledmzaJFk4 UtA6KvfzT/fBYLI1mQ7tL4ESDFVfgwuXgwT5myI= X-Received: by 2002:a37:d9da:: with SMTP id q87-v6mr3320664qkl.302.1527093352450; Wed, 23 May 2018 09:35:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aed:3aaa:0:0:0:0:0 with HTTP; Wed, 23 May 2018 09:35:51 -0700 (PDT) In-Reply-To: <20180509230630.258755-1-gwendal@chromium.org> References: <20180509230630.258755-1-gwendal@chromium.org> From: Enric Balletbo Serra Date: Wed, 23 May 2018 18:35:51 +0200 Message-ID: Subject: Re: [PATCH] cros_ec: Use devm_kzalloc for private data To: Gwendal Grignou Cc: Benson Leung , Lee Jones , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gwendal, 2018-05-10 1:06 GMT+02:00 Gwendal Grignou : > Use dev_kzmalloc, remove .release entry point. > > Signed-off-by: Gwendal Grignou > --- > drivers/mfd/cros_ec_dev.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c > index eafd06f62a3a..45d42511a3e5 100644 > --- a/drivers/mfd/cros_ec_dev.c > +++ b/drivers/mfd/cros_ec_dev.c > @@ -262,13 +262,6 @@ static const struct file_operations fops = { > #endif > }; > > -static void __remove(struct device *dev) > -{ > - struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev, > - class_dev); > - kfree(ec); > -} > - > static void cros_ec_sensors_register(struct cros_ec_dev *ec) > { > /* > @@ -388,7 +381,7 @@ static int ec_device_probe(struct platform_device *pdev) > int retval = -ENOMEM; > struct device *dev = &pdev->dev; > struct cros_ec_platform *ec_platform = dev_get_platdata(dev); > - struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); > + struct cros_ec_dev *ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL); > > if (!ec) > return retval; > @@ -410,7 +403,6 @@ static int ec_device_probe(struct platform_device *pdev) > ec->class_dev.devt = MKDEV(ec_major, pdev->id); > ec->class_dev.class = &cros_class; > ec->class_dev.parent = dev; > - ec->class_dev.release = __remove; > > retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); > if (retval) { > -- > 2.17.0.441.gb46fe60e1d-goog > The patch looks good to me, however, the patch doesn't apply cleanly if you have [1] already applied, and if not, then is this patch ([2]) which doesn't apply cleanly. To not have interdependencies I'd suggest apply first this patch and remove the following from [1] diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index eafd06f62a3a..cad12da7f884 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -264,8 +264,8 @@ static const struct file_operations fops = { static void __remove(struct device *dev) { - struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev, - class_dev); + struct cros_ec_dev *ec = to_cros_ec_dev(dev); + kfree(ec); } With this change, [1] can go through the Benson tree and [2] through Lee tree independently. With the above change feel free to add my Reviewed-by: Enric Balletbo i Serra If you want I can do this rework for you. Best regards, Enric [1] https://patchwork.kernel.org/patch/10390959/ [2] https://patchwork.kernel.org/patch/10390965/