Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp238555yba; Wed, 17 Apr 2019 23:53:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjGgJJuj6ioImyATjesvL9wYmW4CPD0hxU714TTkVqIIe6fGslOWbOaMfx6JXMcdcxDr+/ X-Received: by 2002:a63:dd10:: with SMTP id t16mr4028776pgg.446.1555570409777; Wed, 17 Apr 2019 23:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555570409; cv=none; d=google.com; s=arc-20160816; b=NezdbapkP7VRwHzwvOFM0/Hkc5vN+M+uI1KzBz3CzCDTgnLpbjn72DIk98kDe6GfES 7WT8x0Muj64KeDsfUqCoa69nxLMJbRflPqqU6MPlzZzag30nN6iG2E1jPeLYQWV/KkZe h7YF/njN8mwsXzPenxTu9sIU9spWn/yYVhsUHdaOaUOcIy5SRmhBhvb02NeIfcH6Y1Mc yZqhzEpwsb7NRWNATcNwBdCRbaYzWUETq/vd7sdK+cQP2HkbqnHgB6ev1Pmq68Jw266W KIsWUQQ1eZ0NSJiRfTsCRwV3DyjjSa6qH9vX/4GYi/uWxbSJyLeqFYIE4EzQgr3fr0Cl /n0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OJ4+39NZQ+WGXYX5yTPc1ycWUE/r/gkpIUV4QhSiI8k=; b=0h856fY6j3GqaV3dbcWgALCIO4j1aklXHzOyiQVt57njfphvrrRaPbx1/FJFfBfA3x 76VY1tn9zp4nF1tbewoTDonzUWYB0XYCARJkUSgug/XS22RLfQ/a47ur/fXmpsqNpdXj 2fdAP0wKggbU7wwPB5l3odcrdM+DAkL0fB8VC77KMS7pl05NHcHtGP9G63imzZ14QfBR r2B1aHoHBqUtPqri+L+JpZAU21xCPKVPFBU8hPZdqo0mdnY7w2Ji9ZD1JV544jAe6Uah ovDDspaNfNa9FlXXd1lU7QKH9kcagYVhNhNK5/9vHIzlee3LjqNytk5EEp1nqNBBLZ42 575g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rMw25KgG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i19si1409248pfr.246.2019.04.17.23.53.14; Wed, 17 Apr 2019 23:53:29 -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=@kernel.org header.s=default header.b=rMw25KgG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388098AbfDRGvu (ORCPT + 99 others); Thu, 18 Apr 2019 02:51:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:41632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbfDRGvt (ORCPT ); Thu, 18 Apr 2019 02:51:49 -0400 Received: from localhost (ip-213-127-62-114.ip.prioritytelecom.net [213.127.62.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 68EC420821; Thu, 18 Apr 2019 06:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555570308; bh=o6LIY6vTs/6i7DC083ZG9ubmbx647t5RSiTUOMQj2hc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rMw25KgGfciF0hakANf+3JC6mZgdQz2r5hwzh+6/7khvTVTvCrxoW+jYUyX8qPfQq 0JYA7C0MT1jl7ADDyhJAkL47SLlYu/NB8cQ7ZhAO090/XL47ooMMU8S/FEma0C0j1/ O1LYUtEqXuwDROKZStLwPkL1pGXjws69L0Q9NhMM= Date: Thu, 18 Apr 2019 08:51:41 +0200 From: Greg Kroah-Hartman To: Guenter Roeck Cc: Raul Rangel , 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 , Mathias Nyman Subject: Re: [PATCH v3] usb/hcd: Send a uevent signaling that the host controller had died Message-ID: <20190418065141.GB12503@kroah.com> References: <20190417202017.GA204974@google.com> <20190417224129.GA255388@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) 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 04:20:09PM -0700, Guenter Roeck wrote: > 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. Yeah, I went down this path a year or so ago and had to give it up as well :(