Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3213970ybh; Mon, 5 Aug 2019 14:13:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPtz8wvk/AIZirU6G4a3tlvXlioEwQHYSDVmyYd9eFHJNTK03lA4JDqUHZurB2x3Diu6nv X-Received: by 2002:a63:c203:: with SMTP id b3mr139803380pgd.450.1565039581477; Mon, 05 Aug 2019 14:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565039581; cv=none; d=google.com; s=arc-20160816; b=P/tf0OZyu6tB4UlzRn0iajSlTBKvLJoj0tBKx7FbrtNJPE9oEj1nJQ3ziyfQosZod6 QXqJNptt5MQGjmFZX62R/rM/3XANy1AS2yaejEgcGoZts5YCgU9VqDLFOOLDLqOh1Cqo dMrUdN1iSZGnsTVj5TRu7B/nVMpw0PxDCu+A/lWC9bR8vVYDAyjWfhzqaAbowx+ynQmg +lAJESz9yXzMXWNx/cfgky8GeTVsm+QUMuDRLOGTj6Pkqm/7W3pzDUmNWXTkvM1qLHyF rmzsfpiotLUZb6jL3tOJHNwbq5D7uB1WEoyhcM1FvtBTvvy/uWNhsqE/G/rcfPnfPShx HLyQ== 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=/aLchTHYoHWAQzUHdw1YUw9ePu7ibtM6cSSC7Blp19M=; b=L8iODLeiW7j2zRrUn4oBN3CahrXzWNSSRG60NM8VesqHpfMxvim4nzLLuv73DPeMvj P8VBK135taXbvzAnio1nC9usQDgEbsN3CHO9qaxfwyrm+k0oXp5MB7cYjUA8Uib6vf82 1JEUYoR/82/fqteDmLbA5/lXr9g+h7P0cnNqYMpHcrZGWC2fOYx3XLwNLsXlUd1afZxi m43L6Q44kNxqQkX4iG8ARJqJUseWGM7ZvTk1iGIg6m7lrO7nzeI9ZIIM25ZMWp4xNuvs SvxUzODOPS0s3W1pib58Pa18GKDLHe0W7QR6Cp6sEqRiIls1e49jInHDlZAhfQoRpPJb pchA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=UMHxs4RO; 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=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p95si13305924pjp.4.2019.08.05.14.12.45; Mon, 05 Aug 2019 14:13:01 -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=@android.com header.s=20161025 header.b=UMHxs4RO; 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=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730651AbfHEVMH (ORCPT + 99 others); Mon, 5 Aug 2019 17:12:07 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:36753 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730036AbfHEVMH (ORCPT ); Mon, 5 Aug 2019 17:12:07 -0400 Received: by mail-ot1-f66.google.com with SMTP id r6so87272347oti.3 for ; Mon, 05 Aug 2019 14:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/aLchTHYoHWAQzUHdw1YUw9ePu7ibtM6cSSC7Blp19M=; b=UMHxs4ROxz2PTSqTX0empNVp8Wv+9qWN1sceNStYa1Y9hT35D2cPyiwUZaWElXsMWn u/GsOqo12e1KILmtRe4bX/V/5s6e6j+Ddpix2KoIduL+KR180eWVQE4lIHrCllspGsS1 c1De/nvmdHMHJKAPjZTnxW8SDpjS0CME2/tcMYhy9enE3BaKfsQdc6k2J2rq/eA+RAaF HrpG+KCfCxqcWvSpVIjPHQezTDrvvaMe8UEqv+ye00Zm2qJJKtR+rAmUVYbMbfQmMmym 2YAuTo+s/AwxQYkgou/mhazx//qNWz6NhbtNeSBAzqd5waBJRpB++YPWiqQl59vcN8Bf JUPA== 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=/aLchTHYoHWAQzUHdw1YUw9ePu7ibtM6cSSC7Blp19M=; b=Cc09eqxBmEYtdLAhlgUR3x7Hx7WnKT65T2LNC6dOMGGzBS9sv9PZG/C7+UUlxC9nBh ea9lDT8I1jqv0gB/ZAhMh5gbd3nXHiFJu3dBt4qnEO8JKq4kUFoO/R/ShF00dqpUrizN EC3KlJlNk+nWStZGhVmKXS9uc49N9MW3MKFa/R+EHjqh3+rcr8PgNvc6oKmnoDTqb8AJ TZG7n1VPNfy5dvRc1tZaSRw0bFPYz12NVKarIsjo4x5nCd3RopTgvgdDGJnU3GijrwJV BvmBqsjE8HBPbCAl/YC8Go7dDzSX6SoLBaZLZugJas8OEtvN08mgBJXU8kiQ18gdw/KQ 1HWA== X-Gm-Message-State: APjAAAUDIuqcIT2Z4Bu3Q3jG/LOfCh25vRVYjZ+xsyBipXrtPa28mR3k +50bSBdzA+1uFKjayz0IVBXqTLkewjz8yk9OV4E= X-Received: by 2002:a9d:5911:: with SMTP id t17mr30743705oth.159.1565039526309; Mon, 05 Aug 2019 14:12:06 -0700 (PDT) MIME-Version: 1.0 References: <20190805175848.163558-1-trong@android.com> <20190805175848.163558-2-trong@android.com> <5d48976e.1c69fb81.a6781.3565@mx.google.com> In-Reply-To: <5d48976e.1c69fb81.a6781.3565@mx.google.com> From: Tri Vo Date: Mon, 5 Aug 2019 14:11:55 -0700 Message-ID: Subject: Re: [PATCH v7 1/3] PM / wakeup: Drop wakeup_source_init(), wakeup_source_prepare() To: Stephen Boyd Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Viresh Kumar , "Rafael J. Wysocki" , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , LKML , Linux PM , "Cc: Android 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 On Mon, Aug 5, 2019 at 1:54 PM Stephen Boyd wrote: > > Quoting Tri Vo (2019-08-05 10:58:46) > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c > > index ee31d4f8d856..3938892c8903 100644 > > --- a/drivers/base/power/wakeup.c > > +++ b/drivers/base/power/wakeup.c > > @@ -72,23 +72,6 @@ static struct wakeup_source deleted_ws = { > > .lock = __SPIN_LOCK_UNLOCKED(deleted_ws.lock), > > }; > > > > -/** > > - * wakeup_source_prepare - Prepare a new wakeup source for initialization. > > - * @ws: Wakeup source to prepare. > > - * @name: Pointer to the name of the new wakeup source. > > - * > > - * Callers must ensure that the @name string won't be freed when @ws is still in > > - * use. > > - */ > > -void wakeup_source_prepare(struct wakeup_source *ws, const char *name) > > -{ > > - if (ws) { > > - memset(ws, 0, sizeof(*ws)); > > - ws->name = name; > > - } > > -} > > -EXPORT_SYMBOL_GPL(wakeup_source_prepare); > > - > > /** > > * wakeup_source_create - Create a struct wakeup_source object. > > * @name: Name of the new wakeup source. > > @@ -96,13 +79,23 @@ EXPORT_SYMBOL_GPL(wakeup_source_prepare); > > struct wakeup_source *wakeup_source_create(const char *name) > > { > > struct wakeup_source *ws; > > + const char *ws_name; > > > > - ws = kmalloc(sizeof(*ws), GFP_KERNEL); > > + ws = kzalloc(sizeof(*ws), GFP_KERNEL); > > if (!ws) > > - return NULL; > > + goto err_ws; > > + > > + ws_name = kstrdup_const(name, GFP_KERNEL); > > + if (!ws_name) > > Does this intentionally change this function to return an error if > 'name' is NULL? Before, wakeup_source_prepare() would just assign > ws->name to NULL, but now it errors out. I don't see how it's good or > useful to allow NULL for the wakeup source name, but it is what it is. Yes, the change to not allow ws->name to be NULL is intentional.