Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2559099ybd; Thu, 27 Jun 2019 14:42:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqmL3UjMccGv9YI/VQIGcO8Mpe+skf7xb7uX5h9DLK6LG2vGwn85tUzX7I0QnDrlYDFHwc X-Received: by 2002:a63:161b:: with SMTP id w27mr5769293pgl.338.1561671762018; Thu, 27 Jun 2019 14:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561671762; cv=none; d=google.com; s=arc-20160816; b=ZcmLA7bjIU9qyy1SRcmIRmFevawAXxY2k87b7O4Z89dZ7wzGqdmvqjOWba1+clfksz a9Y5irZl+6WD0KJalcefnIRsPkeLJg9CjcEW6RoVO2Mxbkl16/uAOEOizsWk2TS2Bv4R WfZodptsFk/G6q8ZF8GxQ/weSgq85+1Il+sAgoVx8aBl1bgQLBBHpWkg0e4y+zuRerbc OphY3H4tV3ajyvwt+Zq/78iLsrxqIGmWiZACAsqtwg9obpSuAAnj9BykOA71qsRjs5Zq +/yP04drivc3iGhiK8wrAM9PZuuJtVS9TlAILX49hWPWuLbuM1n6FTWz+YJoz37taIHT LONg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=YMYPQ8HMwHsCu6Nb47E3eYy5SYkz8O/qNoaUqvE9/MA=; b=QQEpreRNOVFZfp1qy0f3cFa809Q+S4NqTJe9i9nYwD1pwQtfAozvpSCAxuD4M4Qm6G 9qY9nGp6Qs707igIes2ww1uF2cDeRox8Zq9AC4KTjont96lOpL2xqjjw9Ejf5fyKC9OO +Tw66MCj23E66FUwAoycTmLUkQqc3vFZQ0B17C4VRZBPM+qPsOkW15Eq8NW60Npwr1U3 KSxAQnZXR1mGvdD7HB1U7Zz8MpDmMYS83WrEjCMJcdxmW5jmP4F7zwnXDQegaxqtRpjX kpCbxIZjJCB9aD8FER4HEwNnkngx3ovplmx1UvA+WIHMjflwvex9wS3mFYyPr/8hoiLd Mq9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i6uS7I64; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si212496pgi.25.2019.06.27.14.42.24; Thu, 27 Jun 2019 14:42:41 -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=@google.com header.s=20161025 header.b=i6uS7I64; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726520AbfF0VmV (ORCPT + 99 others); Thu, 27 Jun 2019 17:42:21 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43218 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726441AbfF0VmU (ORCPT ); Thu, 27 Jun 2019 17:42:20 -0400 Received: by mail-lj1-f196.google.com with SMTP id 16so3841878ljv.10 for ; Thu, 27 Jun 2019 14:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YMYPQ8HMwHsCu6Nb47E3eYy5SYkz8O/qNoaUqvE9/MA=; b=i6uS7I64eUcQYgWj3c9jAsLFmKoZ/q4U1ARoqLXaf/YYG6/XKX4AFmJsVHu8ajhu8F u/851Ek5TISb9oKcMr4gdoc97WJOWUN9L2EaFUzcuHcVgkAFa/aIk00P2zCsY+DEKLbb QVX4X2B53szP9bzFueP7gJQs6nlm5JL1pPJAXbZ7xyVGoTv4qCLOGtK9IlKbuNK7mpS1 V9V4nYBBIn9uw/jdDC6NzHcOCeJdusC/cbvB5yzj/ZOuu/3cHn3fzNuEjgt+KCGgFJax RMZitSXX+ZB+xjhqB/Au1y7H81Xk+YEcQEZ163jAPyP6SEOQRWfTHLbio0Upf6BZZ8CG ok0w== 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=YMYPQ8HMwHsCu6Nb47E3eYy5SYkz8O/qNoaUqvE9/MA=; b=VNntjrJJ/0la/PkoOBdZvI0Y8gSh1y3qMiUe2HYQLRvAmgcyBJns/pApgFk4poOjGs mX122N5lYpKhJpQwSxm64jlxwaeIwoB/My2ch4zNNaumyc3PBkEOhh9W3IGegxsTWT9U aKxZF6cCRSHPPJYXrP/LIvJ11droWcFHfMo43GnlNlhR4l9JJmGZe8ajHDsck4E4mTTK pTBJXkN3cXR7LhJzp+YA+TMt0UvM/NtoU+2//KefGyqu2gc1aFniiOq0wh++lEOIaVvp gu8xAGKqT4oJMhyA3cAS6j7qNfTfmH5s2HxIL/w9FzblUuuFwG51IltNFRT3s0c5XWbk a7VA== X-Gm-Message-State: APjAAAWy61A8m3VG0KfKpCNUXeaX8OmpeqbyuiwIC5aAXoKgj6hQ08tD nGpE4eeqTrhU1zaqkyJULCaiXhLr9hAXzhfx3I37IhWIz5w= X-Received: by 2002:a2e:8345:: with SMTP id l5mr3873254ljh.18.1561671737949; Thu, 27 Jun 2019 14:42:17 -0700 (PDT) MIME-Version: 1.0 References: <20190625205101.33032-1-rajatja@google.com> In-Reply-To: From: Rajat Jain Date: Thu, 27 Jun 2019 14:41:41 -0700 Message-ID: Subject: Re: [PATCH] platform/chrome: lightbar: Assign drvdata during probe To: Enric Balletbo i Serra Cc: Benson Leung , Guenter Roeck , Linux Kernel Mailing List , Evan Green , Rajat Jain 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 Enric, On Wed, Jun 26, 2019 at 1:34 PM Enric Balletbo i Serra wrote: > > Hi Rajat, > > On 25/6/19 22:51, Rajat Jain wrote: > > The lightbar driver never assigned the drvdata in probe method, and thus > > causes a panic when it is accessed at the suspend time. > > Good catch, that's one of the problems I currently have with mainline on Samus. > The other one, that I didn't find time to look at is, that for some reason, when > I suspend the system reboots. Is suspend/resume working for you in current mainline? I haven't tried current mainline yet. (I tried, but wasn't able to build it like I used to. If you have a recipe, can you share and I can give it a try). I was seeing the same symptoms on my Hatch (using 4.19) before this patch. I found this was the cause of the reboot, and is fixed now with this patch. May be you can try on Samus with its fix? > > There is no drvdata because we don't really need extra private data for this > driver, the ec_dev is directly the drvdata provided by device parent. I am > wondering if you can just do > > struct cros_ec_dev *ec_dev = to_cros_ec_dev(dev); > > in the suspend/resume calls like we do in the show/store calls or get the > drvdata from its parent. I guess I prefer the first one. The dev in suspend() callback points to "cros-ec-lightbar" device instead of "cros-ec-dev", so we'd need to reach the parent. I'll send a new patch in a moment. Thanks, Rajat > > > > > Would be nice have a fixes tag here. > > > Signed-off-by: Rajat Jain > > --- > > drivers/platform/chrome/cros_ec_lightbar.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c > > index d30a6650b0b5..98e514fc5830 100644 > > --- a/drivers/platform/chrome/cros_ec_lightbar.c > > +++ b/drivers/platform/chrome/cros_ec_lightbar.c > > @@ -578,11 +578,14 @@ static int cros_ec_lightbar_probe(struct platform_device *pd) > > > > ret = sysfs_create_group(&ec_dev->class_dev.kobj, > > &cros_ec_lightbar_attr_group); > > - if (ret < 0) > > + if (ret < 0) { > > dev_err(dev, "failed to create %s attributes. err=%d\n", > > cros_ec_lightbar_attr_group.name, ret); > > + return ret; > > + } > > > > - return ret; > > + platform_set_drvdata(pd, ec_dev); > > + return 0; > > } > > > > static int cros_ec_lightbar_remove(struct platform_device *pd) > > > > Thanks, > ~ Enric