Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7334384rdb; Wed, 3 Jan 2024 12:10:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoiafTO3t940OYHN/5vEN2L3beacG2lzy/R02Z4fD9qBR06ISzOtdVq6BPyUV7a73KVDmA X-Received: by 2002:a05:6359:69a:b0:172:eba7:5184 with SMTP id ei26-20020a056359069a00b00172eba75184mr16682293rwb.12.1704312627717; Wed, 03 Jan 2024 12:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704312627; cv=none; d=google.com; s=arc-20160816; b=A6B0ti6syHuBGQgqzvbT8a/QxCnVdPGvqZaVBVI3PCcmMdz65nUF5vx4/Pi4Md4t/9 ve2Tmlhy2+2crBHXQjUb/8eBT1F8Od+wWPQC104D90FGhvSRhHCGfuuWJxorPqiiS7NU c8MGj+e2HqA+lyddbvXynAV5/1+icjNDjut+0MbuI1qpLKd74d9Ilman9VrYf9X9D/YC KCtt+X7ugNul82DBBcWkPa3KS90uD87+8zlpSKTLPVK4O7VO7pXy3zRu0q+kajWzY2p1 Tn0yuyJK+qc3U/RqPdVYa8WL6iEoA73mrfJpHb+C2xsTaRJw1QfGUAVhx8Hpx+8O9pbf oPag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=MZOqC+vh8nhBkqQBS+jkEHlXm5GbUXDC2IWE5XgtUcw=; fh=+11RzK2HwM/csbO+0+4bopHgvW31PubhziQ/7jFTPzI=; b=jAUdl08jvt8hJBKoMH9GwusOIpCq3+ysCCoSlzOA7bY1/Vx86XA+OEqZsI54pgMe1E yRbLnSrZiIono2I3yBVJVztlaKZIbDixYGL5hpvbTpVoP6PVPqwT0gsU9FHdc6AbxOOx a1t+JQxHfy+IaqAB4XC7sqTpVZ/+vmEHdOWUS7hVOBQbnLQ3LO/N8ysh/zMq5ZbVzf/L Y2wwi4TvjPqdhETGy/UfBVJdzZivJ4aDy6wWskJXWWvdBB2bBfFQ1qm8l8WKFusn/7je 7L3lo44k9ygcsbQDVj5loLBkWkaJ/Yt/IpcQ2p82RL0cSXC5eRJdg+T95XK4/+BOVgl1 egsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v190-20020a632fc7000000b005c658bf30aasi22412783pgv.412.2024.01.03.12.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 12:10:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-15954-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15954-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A915282B94 for ; Wed, 3 Jan 2024 20:09:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E33121D526; Wed, 3 Jan 2024 20:09:42 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAAE91D692; Wed, 3 Jan 2024 20:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-594363b4783so347704eaf.1; Wed, 03 Jan 2024 12:09:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704312580; x=1704917380; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MZOqC+vh8nhBkqQBS+jkEHlXm5GbUXDC2IWE5XgtUcw=; b=W4yZCJtrMnIEAwJiRbxeRibdxJNLSbttUrq4IhtLOBnihFvFL01XHmClBUlMsoWNyW zqk6b0tlizWQXuccc8TRMagKEjyan8h+n8BSzBgAPi8wmYrw2i5RsAveKxo3GqRkOoL7 ZZCkE+z/4XFGHqttPBTrESoBPzJMMlbJHgChN+avqZ8TnE9BfIT1bcNicf9iYuE3Yauz /z9lloxYog6RNCnPl3wMz4AMxnfmcE+FYVmLgul19/bunqrYvXFyObt9qmPlDhVYyDxb L9Y8SdgEz3sx3HajPJN39uHFd3Pd2iXmws13IA/q72Z2oeOkFTuyK6YiAX+Bildvr5FO 8lLg== X-Gm-Message-State: AOJu0YxXORmARHd3FlvIzSExmxOe27tpObmUW9gFT12aljdh57m60lK/ NZHIeeRSQbpqAdlebrhgrzUlMRN+atofS9ulDcY= X-Received: by 2002:a05:6820:2e01:b0:594:35b4:8a with SMTP id ec1-20020a0568202e0100b0059435b4008amr27264639oob.0.1704312579904; Wed, 03 Jan 2024 12:09:39 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <4556052.LvFx2qVVIh@kreacher> <2938222.e9J7NaK4W3@kreacher> <24822e06-1e5e-41e8-9f68-8fa82b1b11d4@arm.com> In-Reply-To: <24822e06-1e5e-41e8-9f68-8fa82b1b11d4@arm.com> From: "Rafael J. Wysocki" Date: Wed, 3 Jan 2024 21:09:28 +0100 Message-ID: Subject: Re: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change() To: Lukasz Luba Cc: "Rafael J. Wysocki" , Srinivas Pandruvada , Linux PM , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 3, 2024 at 8:57=E2=80=AFPM Lukasz Luba wr= ote: > > > > On 12/15/23 19:56, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Instead of requiring the caller of thermal_notify_tz_trip_change() to > > provide specific values needed to populate struct param in it, make it > > extract those values from objects passed to it by the caller via const > > pointers. > > > > No intentional functional impact. > > > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/thermal/thermal_netlink.c | 12 +++++++----- > > drivers/thermal/thermal_netlink.h | 8 ++++---- > > drivers/thermal/thermal_trip.c | 8 ++------ > > 3 files changed, 13 insertions(+), 15 deletions(-) > > > > Index: linux-pm/drivers/thermal/thermal_netlink.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- linux-pm.orig/drivers/thermal/thermal_netlink.c > > +++ linux-pm/drivers/thermal/thermal_netlink.c > > @@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tz > > return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE,= &p); > > } > > > > -int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_typ= e, > > - int trip_temp, int trip_hyst) > > +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz= , > > + const struct thermal_trip *trip) > > { > > - struct param p =3D { .tz_id =3D tz_id, .trip_id =3D trip_id, > > - .trip_type =3D trip_type, .trip_temp =3D trip_= temp, > > - .trip_hyst =3D trip_hyst }; > > + struct param p =3D { .tz_id =3D tz->id, > > + .trip_id =3D thermal_zone_trip_id(tz, trip), > > + .trip_type =3D trip->type, > > + .trip_temp =3D trip->temperature, > > + .trip_hyst =3D trip->hysteresis }; > > > > return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE,= &p); > > } > > Index: linux-pm/drivers/thermal/thermal_netlink.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- linux-pm.orig/drivers/thermal/thermal_netlink.h > > +++ linux-pm/drivers/thermal/thermal_netlink.h > > @@ -23,8 +23,8 @@ int thermal_notify_tz_trip_up(int tz_id, > > int thermal_notify_tz_trip_delete(int tz_id, int id); > > int thermal_notify_tz_trip_add(int tz_id, int id, int type, > > int temp, int hyst); > > -int thermal_notify_tz_trip_change(int tz_id, int id, int type, > > - int temp, int hyst); > > +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz= , > > + const struct thermal_trip *trip); > > int thermal_notify_cdev_state_update(int cdev_id, int state); > > int thermal_notify_cdev_add(int cdev_id, const char *name, int max_st= ate); > > int thermal_notify_cdev_delete(int cdev_id); > > @@ -79,8 +79,8 @@ static inline int thermal_notify_tz_trip > > return 0; > > } > > > > -static inline int thermal_notify_tz_trip_change(int tz_id, int id, int= type, > > - int temp, int hyst) > > +static inline int thermal_notify_tz_trip_change(const struct thermal_z= one_device *tz, > > I was wondering if it's not too long line, but I can see it's common > in that header file. Shouldn't we break such lines like: > > static inline > int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, > const struct thermal_trip *trip) > > ? IMO the additional line break doesn't really make it easier to read. And note that it is OK now to have code lines longer than 80 chars (as long as they are not longer than 100 chars IIRC), although it is still recommended (but not required any more) to observe the "old" 80 chars length limit. > Although, it would apply to all other long lines in that header, so not > particularly to this $subject. Well, right. > > + const struct thermal_trip= *trip) > > { > > return 0; > > } > > Index: linux-pm/drivers/thermal/thermal_trip.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- linux-pm.orig/drivers/thermal/thermal_trip.c > > +++ linux-pm/drivers/thermal/thermal_trip.c > > @@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct th > > void thermal_zone_trip_updated(struct thermal_zone_device *tz, > > const struct thermal_trip *trip) > > { > > - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, tr= ip), > > - trip->type, trip->temperature, > > - trip->hysteresis); > > + thermal_notify_tz_trip_change(tz, trip); > > __thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED); > > } > > > > @@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct t > > return; > > > > trip->temperature =3D temp; > > - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, tr= ip), > > - trip->type, trip->temperature, > > - trip->hysteresis); > > + thermal_notify_tz_trip_change(tz, trip); > > } > > EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp); > > > > > > > > Other than the comment above, LGTM. > > Reviewed-by: Lukasz Luba Thanks!