Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1707057rwn; Fri, 9 Sep 2022 02:50:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5U7XLsVqKXDDofjw8ufxNXTXzZ51d1FiGjQe8VZUl2G0qN0RsGlc6k5k3G9DtAJ86jwSme X-Received: by 2002:a2e:81d4:0:b0:26b:e6e1:3d46 with SMTP id s20-20020a2e81d4000000b0026be6e13d46mr420048ljg.157.1662717002624; Fri, 09 Sep 2022 02:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662717002; cv=none; d=google.com; s=arc-20160816; b=GNSkF+wa4nQ/jkBit5C/+RC7bf4yr2x9ukI/VeJMQG9ljq3d6HkuS5DqygLzxPrZNG enLxGd8fJJFIru16hLxORlEG+VPHNUG2TbPJElUyh5SH8RCQXx1pDcAWnh+1hB2R2Pu4 Z3mBUaoV7qAKnDPVg4vqiH2FcAl0HSJncoN683hh1NuHskMuJkWgIz3r92iB8ewkwf42 /CDsFILlyGFPVtE7avlnLebicCcOw8UCUJf/1m6gdMDGFEOEPRfn67YZBB19kvOL2DFt 1WzLPO6R3fXrPXc1trMFdz1spUgghimX5ehOnye6d4hWniSYvHfILv7pzXAvBIqoYMqA fU1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rx+Xj6kNsjTGjbwHEWq+tn+y0SwxN5dk8VZnA0vE+cI=; b=A5yY8V/5FFh0AN/lw6/IKgc16roUxZs9tUAhxpjVksvCS24OJgUstyO+0XZG3zJFEA iCi121koqIni/B6YaTIDh8nJf5gPpz599qnSrjo85N+EHmSilTIkZ3PsK0Q16zlOl/P/ E/D8Exi7NeK6qQShxC2wXVgKarWZyU86TMEcWdXiXCgLXUhz9vzLV/aQRDP6jNyBxQni McQ84EK7cE4iPhVi7L/FZlkEnn8bbKBUOTOcKTEyfF11bTt1roRsEoA4azrbJREm9Imy RxzgPJ0dquFqjclHRRkmufSbIJSx3zF9KF+RFMfIRp46H7dDSA0V94VbrC5gWVYzpDWN +njQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUxhLvLZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a05651220c600b0049499a43f85si17243lfr.450.2022.09.09.02.49.34; Fri, 09 Sep 2022 02:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mUxhLvLZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231414AbiIIIsN (ORCPT + 99 others); Fri, 9 Sep 2022 04:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbiIIIsD (ORCPT ); Fri, 9 Sep 2022 04:48:03 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F8212D19C for ; Fri, 9 Sep 2022 01:48:01 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id z23so1030590ljk.1 for ; Fri, 09 Sep 2022 01:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=rx+Xj6kNsjTGjbwHEWq+tn+y0SwxN5dk8VZnA0vE+cI=; b=mUxhLvLZRdGyYmtuFWlZcNusjoJOhVWVZ1+Bciu2ZmksTLSSjbBOFKEd+oDoZIwibI /2D+zYHfnBky85VAH3kOBX4YRlf0iD36nRB68rtWIWZJbICvwlJLa8kvr+9y/FQf+nQF VfdTlzciU964hWB7seOxgrpvOtUHQTBITo32KaPkRNqCWnT4VYfz/IMZpSC0/VisI6Jt j4orSO0blDZ0nOfNJ6uB3ouqhW+r9+KaK22MSaBt5hEkEV3VxOfXeLHqMJhvpzbouRrG rV6RV/oVpZ4FP/zwUWqQrHMahs8EkI4wYbZycLHWJkg91XTX4rq/6zoLGASGRA7lJqMk YXZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=rx+Xj6kNsjTGjbwHEWq+tn+y0SwxN5dk8VZnA0vE+cI=; b=f+aDRhDVw1kie2eDUrpe3uUBOs1+yGJhCLX2NHVWIQU3i1smWy+hscdjmuigXJx+pw rtVa/AeFl7WgDTma2AOBnQtJZvTAQU34Y2qH9KRBLghMxisPflANGsC3AUTXKWXlGgyl YR1QPUd+pOsrJx+QhUT0JdwefuDbdyYvXfbO5h3peIcX/2AvaO1hiNSPMyGb/rjI3co0 emhXzvli8UShJTaYhTnzJygi1l02rR5bqc/G/0w6L3qHZU0rnxyAMP7gvmnpl5f3Bq11 cF0uhVJaspnqubXv5LeGd20Ayp3NuR/VitVMGexZds0HUuJ5rXAoFjtuJo86lVzKMjbj RQlA== X-Gm-Message-State: ACgBeo13O9Z8fJfY+cnrgB1KdWb/Y1x4lGrMGPufsRnVEfR7eYrR5Htm fa3rC2LEtiyfUrtByBLIG/+TaA== X-Received: by 2002:a2e:bf01:0:b0:25f:df1a:f39d with SMTP id c1-20020a2ebf01000000b0025fdf1af39dmr3901873ljr.365.1662713278501; Fri, 09 Sep 2022 01:47:58 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id v8-20020a056512348800b0049707888a61sm177188lfr.293.2022.09.09.01.47.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Sep 2022 01:47:58 -0700 (PDT) Message-ID: <8999ed83-4c91-a3d5-3821-d89e3ef11add@linaro.org> Date: Fri, 9 Sep 2022 10:47:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v7 1/4] drivers: hwmon: Add max31760 fan speed controller driver Content-Language: en-US To: Ibrahim Tilki , jdelvare@suse.com, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nurettin Bolucu References: <20220909071618.231246-1-Ibrahim.Tilki@analog.com> <20220909071618.231246-2-Ibrahim.Tilki@analog.com> From: Krzysztof Kozlowski In-Reply-To: <20220909071618.231246-2-Ibrahim.Tilki@analog.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/09/2022 09:16, Ibrahim Tilki wrote: > MAX31760 is a precision fan speed controller with nonvolatile lookup table. > Device has one internal and one external temperature sensor support. > Controls two fans and measures their speeds. Generates hardware alerts when > programmable max and critical temperatures are exceeded. > > Signed-off-by: Ibrahim Tilki > Reviewed-by: Nurettin Bolucu > + > +static int max31760_probe(struct i2c_client *client) > +{ > + struct device *dev = &client->dev; > + struct max31760_state *state; > + struct device *hwmon_dev; > + int ret; > + > + state = devm_kzalloc(dev, sizeof(struct max31760_state), GFP_KERNEL); sizeof(*) run checkpatch on your code > + if (!state) > + return -ENOMEM; > + > + state->regmap = devm_regmap_init_i2c(client, ®map_config); > + if (IS_ERR(state->regmap)) > + return dev_err_probe(dev, > + PTR_ERR(state->regmap), > + "regmap initialization failed\n"); > + > + dev_set_drvdata(dev, state); > + > + /* Set alert output to comparator mode */ > + ret = regmap_set_bits(state->regmap, REG_CR2, CR2_ALERTS); > + if (ret) > + return dev_err_probe(dev, ret, "cannot write register\n"); > + > + max31760_create_lut_nodes(state); > + > + hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, > + state, > + &max31760_chip_info, > + state->groups); > + > + return PTR_ERR_OR_ZERO(hwmon_dev); > +} > + > +static const struct of_device_id max31760_of_match[] = { > + {.compatible = "adi,max31760"}, > + { } > +}; > +MODULE_DEVICE_TABLE(of, max31760_of_match); > + > +static const struct i2c_device_id max31760_id[] = { > + {"max31760"}, > + { } > +}; > +MODULE_DEVICE_TABLE(i2c, max31760_id); > + > +static int __maybe_unused max31760_suspend(struct device *dev) > +{ > + struct max31760_state *state = dev_get_drvdata(dev); > + > + return regmap_set_bits(state->regmap, REG_CR2, CR2_STBY); > +} > + > +static int __maybe_unused max31760_resume(struct device *dev) > +{ > + struct max31760_state *state = dev_get_drvdata(dev); > + > + return regmap_clear_bits(state->regmap, REG_CR2, CR2_STBY); > +} > + > +static SIMPLE_DEV_PM_OPS(max31760_pm_ops, max31760_suspend, max31760_resume); DEFINE_SIMPLE_DEV_PM_OPS and drop maybe_unused. > + > +static struct i2c_driver max31760_driver = { > + .class = I2C_CLASS_HWMON, > + .driver = { > + .name = "max31760", > + .of_match_table = of_match_ptr(max31760_of_match), of_match_ptr goes with maybe_unuses. You should see compile test warnings... Best regards, Krzysztof