From patchwork Thu Jan 4 20:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 10145617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3160160329 for ; Thu, 4 Jan 2018 20:17:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 281C928883 for ; Thu, 4 Jan 2018 20:17:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D0D628885; Thu, 4 Jan 2018 20:17:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C32128883 for ; Thu, 4 Jan 2018 20:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbeADURg (ORCPT ); Thu, 4 Jan 2018 15:17:36 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36818 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751829AbeADURf (ORCPT ); Thu, 4 Jan 2018 15:17:35 -0500 Received: by mail-pf0-f195.google.com with SMTP id p84so1237075pfd.3 for ; Thu, 04 Jan 2018 12:17:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xWpmD2uEKwQ2lgWqtjtU7aQCHXLSfNT1RxXxaG4/HT4=; b=Ocr8YkwdKFIW7sKCMynRgCfuTuuo+aR4Q10eon85xWbnYPHsGaFEmtsy/L580VICbs DdYTtxX5oSHlF7pg9Pomvp8lGiqOR67AJUQtaTz1ZGSsmjV0dckm1qn6wmg5HlT0xEyW SkVlILpiv1060krq2Jsw7oPi/LeppSwPDQdHuron8QM9JNzfDySVaZkYq4fiTOR9bZae 8ytybY8C5vD4OW5CAACGKCQ1Yh1xT5Ac0BHGH6/HcMXm2Q3EnKH3UsDJSrmVveUHvnyJ eHYW8fFUFMtQCk0OslCu+i4x9ELSWmIJpx7vn+BvgeJkVarbdB63G/w8e3TGc1n4jIsF BdrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xWpmD2uEKwQ2lgWqtjtU7aQCHXLSfNT1RxXxaG4/HT4=; b=B+ooi1/q360pFxBHvcyGZSow7FQ0FOjj0UUCgVum9Qbg5OMpUFgj4yObXQJE1hcCDw fH/e4UPnU1IaIMktmoHHH2qJHeP/0LW8lgFFErEHhLT2wpuXlTbiNzCqnOaya0tVeF+b ZQlW44eCFWhBTH+38GzJ50Ac3+0blvgj7hVaPe3QB3s+RlkXQoUjzkasLAgkTHSYzCw0 dOMX8Sod0d/0UMlIDi2OuEAh05Lvj9QG5a9XooXIz4X4+y09ojTEj1j6V1zrS8KluNAd e5wvyi9/lGnB7ZIpFS312gvqW/9zEgV0HdETvza96upJEBqWcRx5qiFpNBFBAfVv/zVz OTKg== X-Gm-Message-State: AKGB3mKBecygtkhE8qRHDDJXSJPFYBxi+pT8pfhSjxCU6689bUuBDD2F 6Ly3eepkJJaNtvvO+EPc9udEM8W6t6Y= X-Google-Smtp-Source: ACJfBou+JU1pmw/qq4Dsl0vA1CFXNt/2M/j2u9EGEVSHAXkVjNDlrTOeOpjcIKTtnUw7lT7ZmEuxpw== X-Received: by 10.98.49.134 with SMTP id x128mr646564pfx.163.1515097054488; Thu, 04 Jan 2018 12:17:34 -0800 (PST) Received: from gwendal.mtv.corp.google.com ([172.22.113.171]) by smtp.gmail.com with ESMTPSA id k12sm7648839pgc.29.2018.01.04.12.17.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jan 2018 12:17:33 -0800 (PST) From: Gwendal Grignou To: enric.balletbo@collabora.com, jic23@kernel.org, groeck@chromium.org Cc: linux-iio@vger.kernel.org Subject: [PATCH 1/3] iio: cros_ec: light code cleanup Date: Thu, 4 Jan 2018 12:17:16 -0800 Message-Id: <20180104201718.221900-2-gwendal@chromium.org> X-Mailer: git-send-email 2.16.0.rc0.223.g4a4ac83678-goog In-Reply-To: <20180104201718.221900-1-gwendal@chromium.org> References: <20180104201718.221900-1-gwendal@chromium.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - use dev instead of &pdev->dev when defined - remove syfs.h inclusion. Signed-off-by: Gwendal Grignou --- drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 5 ++--- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c index 7d30c59da3e2..2297c8ce7cb8 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -29,7 +29,6 @@ #include #include #include -#include #include "cros_ec_sensors_core.h" @@ -201,7 +200,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev) return -EINVAL; } - indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*state)); + indio_dev = devm_iio_device_alloc(dev, sizeof(*state)); if (!indio_dev) return -ENOMEM; @@ -241,7 +240,7 @@ static int cros_ec_sensors_probe(struct platform_device *pdev) channel->type = IIO_MAGN; break; default: - dev_err(&pdev->dev, "Unknown motion sensor\n"); + dev_err(dev, "Unknown motion sensor\n"); return -EINVAL; } } diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 416cae5ebbd0..d50a32ba91fe 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "cros_ec_sensors_core.h" @@ -41,13 +40,13 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct cros_ec_sensors_core_state *state = iio_priv(indio_dev); - struct cros_ec_dev *ec = dev_get_drvdata(pdev->dev.parent); + struct cros_ec_dev *ec = dev_get_drvdata(dev->parent); struct cros_ec_sensor_platform *sensor_platform = dev_get_platdata(dev); platform_set_drvdata(pdev, indio_dev); state->ec = ec->ec_dev; - state->msg = devm_kzalloc(&pdev->dev, + state->msg = devm_kzalloc(dev, max((u16)sizeof(struct ec_params_motion_sense), state->ec->max_response), GFP_KERNEL); if (!state->msg) @@ -62,7 +61,7 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset; state->msg->outsize = sizeof(struct ec_params_motion_sense); - indio_dev->dev.parent = &pdev->dev; + indio_dev->dev.parent = dev; indio_dev->name = pdev->name; if (physical_device) {