Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6940437imu; Wed, 14 Nov 2018 09:12:58 -0800 (PST) X-Google-Smtp-Source: AJdET5eQ63v3IgN95sKPP/0RVQYf5eCQ+xqNRFjUtp69Po15c53hLydIoZHMVXyOvaHs/DCr2jOm X-Received: by 2002:a63:5b1f:: with SMTP id p31mr2503597pgb.56.1542215577947; Wed, 14 Nov 2018 09:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542215577; cv=none; d=google.com; s=arc-20160816; b=ISVGlysRG5igjCMcRG6TPEyOAOE85NIxtNJ4NrLB7YM5EzCxCYnbryYTGc4CE7qHJ6 R6tDbSaCOxNR4yhQDhNsDD170L4gDYUySIcg/Dnjak+thORpH5LJzrhKb4oWgDuQ28hW teasMmAcM21/Q2QZf7M1/0i3GTb+UNCx5H8pf/RU4oluZHf+JdVagTWp3N4WI9ygld/n Hq+MVtbeov2U8fi4MVsQxxtDNJidJYyuOhTiISWew4kEPn/9mCn15GRiJQE/gXZtCiVj KW99oR+7ZuWy6QgCwDK2ACgcWH5v0B4CLbfqovnfs5+a1bnXm1cku/yW59G8WIUgWDaf DXww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=NKxqf4LbSrCCgWoJBGh05L1vS7fjj5wMoVk5fG4umVo=; b=hW0fqHWHJvkNHnNhAtXlr4KLFi4He5/QTe6PlOQa9sVdOS46JBM+BM9rTqTX9xbjNG S0f1hZlY6U4gasFkrhzVwWfNgVZfLWSO6smw/2SC+g8aIqSbMyv/FMiU/iOBWyA1K7Ny MRWzRHFPRqmyyeFfZCgMTp+a4dGZ8p+qHoI77lh6HywjldvoWvBjGjS/GPb6ad6QUefU Y3WUqRA3Kk221Hjzaaoeo/jItm0NKzHRKPopYGUnzyRoIBvS22Y5ifkLmP1OdAM9dJVR zIfuKrxWJGBvkU3x9QIbux0Mb+aOiA5xRvKCe8ECF0nr8rk4TInFYzuwPFcRd7boG3fA 4HgA== ARC-Authentication-Results: i=1; mx.google.com; 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 k27-v6si26702694pfb.216.2018.11.14.09.12.20; Wed, 14 Nov 2018 09:12:57 -0800 (PST) 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; 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 S1732765AbeKODOZ (ORCPT + 99 others); Wed, 14 Nov 2018 22:14:25 -0500 Received: from shell.v3.sk ([90.176.6.54]:46155 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725759AbeKODOZ (ORCPT ); Wed, 14 Nov 2018 22:14:25 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 09FDE46459; Wed, 14 Nov 2018 18:10:18 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 156NOISiFMMO; Wed, 14 Nov 2018 18:10:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 878A6467C6; Wed, 14 Nov 2018 18:10:13 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id NYW20k4StrK7; Wed, 14 Nov 2018 18:10:12 +0100 (CET) Received: from belphegor (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id CDBAF46459; Wed, 14 Nov 2018 18:10:11 +0100 (CET) Message-ID: <92612aad296f8204af80573ab99f256c026e3801.camel@v3.sk> Subject: Re: [PATCH 13/15] power: supply: olpc_battery: Move priv data to a struct From: Lubomir Rintel To: Pavel Machek Cc: Mark Brown , Geert Uytterhoeven , Darren Hart , Andy Shevchenko , Greg Kroah-Hartman , James Cameron , Sebastian Reichel , Rob Herring , Mark Rutland , Eric Miao , Haojian Zhuang , Daniel Mack , Robert Jarzmik , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org, linux-pm@vger.kernel.org Date: Wed, 14 Nov 2018 18:10:10 +0100 In-Reply-To: <20181104143743.GF23864@amd> References: <20181010172300.317643-1-lkundrak@v3.sk> <20181010172300.317643-14-lkundrak@v3.sk> <20181104143743.GF23864@amd> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.2 (3.30.2-2.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2018-11-04 at 15:37 +0100, Pavel Machek wrote: > Hi! > > > The global variables for private data are not too nice. I'd like some > > more, and that would clutter the global name space even further. > > > > Signed-off-by: Lubomir Rintel > > Reviewed-by: Andy Shevchenko > > Ok... > > > - olpc_bat = power_supply_register(&pdev->dev, &olpc_bat_desc, NULL); > > - if (IS_ERR(olpc_bat)) { > > - ret = PTR_ERR(olpc_bat); > > - goto battery_failed; > > - } > > + data->olpc_bat = devm_power_supply_register(&pdev->dev, &olpc_bat_desc, &psy_cfg); > > + if (IS_ERR(data->olpc_bat)) > > + return PTR_ERR(data->olpc_bat); > > > > - ret = device_create_bin_file(&olpc_bat->dev, &olpc_bat_eeprom); > > + ret = device_create_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); > > if (ret) > > - goto eeprom_failed; > > + return ret; > > > > - ret = device_create_file(&olpc_bat->dev, &olpc_bat_error); > > + ret = device_create_file(&data->olpc_bat->dev, &olpc_bat_error); > > if (ret) > > goto error_failed; > > > > if (olpc_ec_wakeup_available()) { > > - device_set_wakeup_capable(&olpc_ac->dev, true); > > - device_set_wakeup_capable(&olpc_bat->dev, true); > > + device_set_wakeup_capable(&data->olpc_ac->dev, true); > > + device_set_wakeup_capable(&data->olpc_bat->dev, true); > > } > > > > return 0; > > > > error_failed: > > - device_remove_bin_file(&olpc_bat->dev, &olpc_bat_eeprom); > > -eeprom_failed: > > - power_supply_unregister(olpc_bat); > > -battery_failed: > > - power_supply_unregister(olpc_ac); > > + device_remove_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); > > return ret; > > } > > ...but you are changing error handling here, which is not mentioned in > the changelog, and I'm nut sure you got it right. > > Are you sure? I can't see what's wrong. I'll split the priv structure and devm/error handling changes into two separate patches as you're right they indeed are somewhat unrelated. If v2 (tomorrow or so) will still seem wrong to you I'd be thankful if you could elaborate a bit more. > > > static int olpc_battery_remove(struct platform_device *pdev) > > { > > - device_remove_file(&olpc_bat->dev, &olpc_bat_error); > > - device_remove_bin_file(&olpc_bat->dev, &olpc_bat_eeprom); > > - power_supply_unregister(olpc_bat); > > - power_supply_unregister(olpc_ac); > > + struct olpc_battery_data *data = platform_get_drvdata(pdev); > > + > > + device_remove_file(&data->olpc_bat->dev, &olpc_bat_error); > > + device_remove_bin_file(&data->olpc_bat->dev, &olpc_bat_eeprom); > > return 0; > > } > > Here too. > Pavel Cheers Lubo