Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4647570yba; Wed, 17 Apr 2019 16:22:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLDqDNY4GPNRCGxKFCOEzb42e8BlgDZ/zZZHDlklK8y7nuUUtC2aYZA92C4ecKqilHRYQ8 X-Received: by 2002:a62:47d0:: with SMTP id p77mr92645404pfi.95.1555543369477; Wed, 17 Apr 2019 16:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555543369; cv=none; d=google.com; s=arc-20160816; b=l9agTuiHLg2qUYWJWKrkeKXUa0A9IIhVAlC4a3fpnDIqsTwwaQNp6ZjxjjlX9rMOop xagm861Rm+2vn5J/9Gpp7oUPn/69QrQJVS6NJwUkx2190IO6JMPLV851x8EewQfWQbyD SJjFfUAPdeuEHYoZZS7gjFh3r1BpFq88uMBIE2VPiUbHHgPtQyr1Vyez950w7rylOdTs Vlir2GuMzzPhCJOgjmUD40KOdM3K2OcAsDcGbyMdpL/wETUoc0suYnhxnQbQpy0YPoq0 K7SLX4hX+Xj4zMmFilrfn10wvTZrmopQyXIFXqf+rTwgDHS1KBl37OGqPw4k/K6c2gZV 2kHw== 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=Fs+8ugTzVY+/dgW7sUSk5w9Um1dxgebbM67FXktR1wE=; b=lcQXjE8mg48cVelUQ/3XPV6RE/Iad+ptevlZNm6JyQdI3p3ZYXbjAMsdGkk9gZ0SPy Svr8tF8VGJkypkrN+VG7WwhwyJJRnfiUj+b+Qyzu9MnEdGCMTckFfy6A80joC/zvwdFW msaoePkDRq4b6nUJ5mw6FK6+TwQIxvk6dwOVHtM8CZ5Nctb9Msw5bCdz6xlwmSsvyYGt 9lrAbwncqQCyRPRu2/9ImYqzl+DBB7yte1D8scTnQStORsn8dppCu1CNJiyH0mCH51Kv RaJ/YjLVquHYBpz5MY1PFAGJMD45QPS7+dYonYQKIQ6RCQI+lHhIey2hOF/xZKCfTY85 fJ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="hqgGIY8/"; 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 m3si210201pgv.28.2019.04.17.16.22.34; Wed, 17 Apr 2019 16:22:49 -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="hqgGIY8/"; 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 S2387681AbfDQXUW (ORCPT + 99 others); Wed, 17 Apr 2019 19:20:22 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:39776 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387630AbfDQXUV (ORCPT ); Wed, 17 Apr 2019 19:20:21 -0400 Received: by mail-yb1-f194.google.com with SMTP id x71so180498ybe.6 for ; Wed, 17 Apr 2019 16:20:21 -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=Fs+8ugTzVY+/dgW7sUSk5w9Um1dxgebbM67FXktR1wE=; b=hqgGIY8/B1WgS2E/mVmsxDEUCox8KZXWWJWhKKc88DQia3Bc7N5Olv4Ll77YIxb6Cp uWKPGsknJpWwCDJPprjwlmOi+PRQWC6OiEpu+TP6JsV8cTZO2SctvE2vd39sps+Km+IU spkRO9WhcuQmlZzZYT5X4oL6PEY+9R3zzF0oe67tMGiwJTD1UC4Jo1B5NFHsMWXV4iDh wiUxcQ674r/R6YAqnpHTkxN3Ov7mwDzkNPLMZ6414/2WCIXz9rCoCqLnOEHvLP9NqOUG We2Hhe063BSih6lRzqQaC1Wpq5iMb/P2dsuZPQgKAbNLr+AndEJSPF31S1NcVV1cMTZS InQw== 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=Fs+8ugTzVY+/dgW7sUSk5w9Um1dxgebbM67FXktR1wE=; b=dgGEBdr2E7rzdfk+zot2vcRj988v50nQ7Pzh4GewPHSMuMvcRal1ke0pxmn9WoRXOR RM3gWsYoanGeru0BnWMf2a49Wk2mYJ7n92fvKtWreIiAdQSSsvu8+HWPLJPXqYoZx23y 3PN+Jz/6AfU11Z2uUT5eEvrNxMDZSCAVqRyhev3/uANnoUNs9dDMu1/YK/THH7BbXvHB 9lKgyxa1uRiVYFB24DkK/x0iw3hgP4jYJGYyVf03jAJYxy6iOQlL7mxpUTfETk60tXr/ 5TPTbWfvtujNmYJzKRQ65mCI6YApvpZZLwqv4d8nMguJU4o4x+jfjZlizT6qCSQ/ms9K O31w== X-Gm-Message-State: APjAAAUDiMvc4j84FcErAuQykjgYM0J23gIitVtcvWrr/O+mbdyQFnqV k9AMb84tABGF3aYU8t75LJxJ+MLnpQjfLSC1ceBkdw== X-Received: by 2002:a25:ca95:: with SMTP id a143mr61114536ybg.282.1555543220991; Wed, 17 Apr 2019 16:20:20 -0700 (PDT) MIME-Version: 1.0 References: <20190417202017.GA204974@google.com> <20190417224129.GA255388@google.com> In-Reply-To: <20190417224129.GA255388@google.com> From: Guenter Roeck Date: Wed, 17 Apr 2019 16:20:09 -0700 Message-ID: Subject: Re: [PATCH v3] usb/hcd: Send a uevent signaling that the host controller had died To: Raul Rangel Cc: Alan Stern , linux-usb@vger.kernel.org, Guenter Roeck , Oliver Neukum , Daniel Kurtz , zwisler@chromium.org, Sebastian Andrzej Siewior , Martin Blumenstingl , Dmitry Torokhov , linux-kernel , "Gustavo A. R. Silva" , Miquel Raynal , Johan Hovold , Greg Kroah-Hartman , Mathias Nyman 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 Wed, Apr 17, 2019 at 3:41 PM Raul Rangel wrote: > > On Wed, Apr 17, 2019 at 03:23:52PM -0700, Guenter Roeck wrote: > > On Wed, Apr 17, 2019 at 3:11 PM Raul Rangel wrote: > > > > > > On Wed, Apr 17, 2019 at 04:39:23PM -0400, Alan Stern wrote: > > > > > > > > This sounds like a golden opportunity! Submit a separate patch making > > > > the parameter to kobject_uevent_env be const (actually const char * > > > > const []), then submit this patch on top of that one. > > > So there are other parts of the code base that dynamically create their > > > array values. So by making the function take const, it breaks :( > > > > Confused. The calling code can still be non-const. I don't see the > > parameter modified in kobject_uevent_env(), so declaring it const > > should be possible. Can you give an example of code that no longer > > works ? > static int notify_user_space(struct thermal_zone_device *tz, int trip) > { > char *thermal_prop[5]; > int i; > > mutex_lock(&tz->lock); > thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", tz->type); > thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", tz->temperature); > thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=%d", trip); > thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", tz->notify_event); > thermal_prop[4] = NULL; > kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, thermal_prop); > for (i = 0; i < 4; ++i) > kfree(thermal_prop[i]); > mutex_unlock(&tz->lock); > return 0; > } > > drivers/thermal/user_space.c:48:52: error: passing 'char *[5]' to parameter of type 'const char *const *' discards qualifiers in nested pointer types [-Werror,-Wincompatible-pointer-types-discards-qualifiers] > kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, thermal_prop); > ^~~~~~~~~~~~ > include/linux/kobject.h:238:22: note: passing argument to parameter 'envp' here > const char *const envp[]); > ^ > > http://c-faq.com/ansi/constmismatch.html explains why it fails. > Interesting. One never stops learning. So the best you could do would be char * const envp[], but I guess that doesn't help much. Guenter > Raul > > > > > Thanks, > > Guenter > > > > > > > > > > Alan Stern > > > >