Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966289AbbD2Qzh (ORCPT ); Wed, 29 Apr 2015 12:55:37 -0400 Received: from mga01.intel.com ([192.55.52.88]:58554 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965639AbbD2Qzd convert rfc822-to-8bit (ORCPT ); Wed, 29 Apr 2015 12:55:33 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,671,1422950400"; d="scan'208";a="721157000" From: "Yang, Fei" To: "Zha, Qipeng" , "linux-kernel@vger.kernel.org" CC: "lee.jones@linaro.org" , "sameo@linux.intel.com" , "Zhong, Huiquan" , "Chen, Jason CJ" , "Zheng, Qi" Subject: RE: [PATCH] mfd: add Intel Broxton Whiskey Cove PMIC driver Thread-Topic: [PATCH] mfd: add Intel Broxton Whiskey Cove PMIC driver Thread-Index: AQHQe39pcoKyiOs1OE+YRrfTP2i4fZ1kQXlg Date: Wed, 29 Apr 2015 16:55:31 +0000 Message-ID: <02E7334B1630744CBDC55DA858622583492E70D0@ORSMSX102.amr.corp.intel.com> References: <1429572995-67886-1-git-send-email-qipeng.zha@intel.com> In-Reply-To: <1429572995-67886-1-git-send-email-qipeng.zha@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2493 Lines: 77 > +/* Whiskey Cove PMIC share same ACPI ID between different platforms */ > +#define BROXTON_PMIC_WC_HRV 4 > +static int bxtwc_probe(struct platform_device *pdev) { > + int ret; > + struct resource *res; > + struct intel_soc_pmic *pmic; > + acpi_status status; > + unsigned long long hrv; > + acpi_handle handle = ACPI_HANDLE(&pdev->dev); > + > + status = acpi_evaluate_integer(handle, "_HRV", NULL, &hrv); > + if (ACPI_FAILURE(status)) { > + dev_err(&pdev->dev, "ACPI error when get _HRV\n"); > + return -ENODEV; > + } > + if (hrv != BROXTON_PMIC_WC_HRV) { > + dev_err(&pdev->dev, "Wrong _HRV %llu\n", hrv); > + return -ENODEV; > + } > + > + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > + if (!res) { > + dev_err(&pdev->dev, "No irq resource?\n"); > + return -ENOENT; > + } > + > + pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); > + if (!pmic) > + return -ENOMEM; > + > + dev_set_drvdata(&pdev->dev, pmic); > + pmic->irq = res->start; > + pmic->dev = &pdev->dev; > + pmic->default_i2c_addr = BXTWC_DEVICE1_ADDR; > + > + pmic->regmap = devm_regmap_init_pmic_ipc(pmic, &bxtwc_regmap_config); > + if (IS_ERR(pmic->regmap)) { > + ret = PTR_ERR(pmic->regmap); > + dev_err(&pdev->dev, "Fail to init pmic ipc regmap: %d\n", ret); > + return ret; > + } > + > + ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, > + IRQF_ONESHOT | IRQF_SHARED, > + 0, &bxtwc_regmap_irq_chip, > + &pmic->irq_chip_data); > + if (ret) { > + dev_err(&pdev->dev, "Fail to add irq chip\n"); > + goto err_irq_chip; > + } I ran into a kernel panic in regmap_exit in case the above regmap_add_irq_chip call failed. I don't see other PMIC drivers is calling regmap_exit, can you investigate if that is necessary? > +err_irq_chip: > + regmap_exit(pmic->regmap); > + > + return ret; > +} > + > +static int bxtwc_remove(struct platform_device *pdev) { > + struct intel_soc_pmic *pmic = dev_get_drvdata(&pdev->dev); > + > + sysfs_remove_group(&pdev->dev.kobj, &bxtwc_group); > + mfd_remove_devices(&pdev->dev); > + regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); > + regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2); > + regmap_exit(pmic->regmap); Please investigate if regmap_exit call is necessary. > + return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/