lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200328170407.41d8ed68@archlinux>
Date:   Sat, 28 Mar 2020 17:04:07 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Jishnu Prakash <jprakash@...eaurora.org>
Cc:     agross@...nel.org, bjorn.andersson@...aro.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        mka@...omium.org, linus.walleij@...aro.org, sboyd@...eaurora.org,
        Jonathan.Cameron@...wei.com, smohanad@...eaurora.org,
        kgunda@...eaurora.org, aghayal@...eaurora.org,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        linux-arm-msm@...r.kernel.org, linux-iio@...r.kernel.org,
        linux-arm-msm-owner@...r.kernel.org
Subject: Re: [PATCH 3/3] iio: adc: Add support for PMIC7 ADC

On Tue, 24 Mar 2020 21:14:10 +0530
Jishnu Prakash <jprakash@...eaurora.org> wrote:

> The ADC architecture on PMIC7 is changed as compared to PMIC5. The
> major change from PMIC5 is that all SW communication to ADC goes through
> PMK8350, which communicates with other PMICs through PBS when the ADC
> on PMK8350 works in master mode. The SID register is used to identify the
> PMICs with which the PBS needs to communicate. Add support for the same.
> 
> In addition, add definitions for ADC channels and virtual channel
> definitions per PMIC, to be used by ADC clients for PMIC7.
> 
> Signed-off-by: Jishnu Prakash <jprakash@...eaurora.org>

A few additions from me.

> ---

...

>  
> +static int adc5_exit(struct platform_device *pdev)
> +{
> +	struct adc5_chip *adc = platform_get_drvdata(pdev);
> +
> +	mutex_destroy(&adc->lock);

Andy raised potential races.  You definitely have some as this
will destroy the mutex before you've removed the userspace interfaces.

> +	return 0;
> +}
> +
>  static struct platform_driver adc5_driver = {
>  	.driver = {
>  		.name = "qcom-spmi-adc5.c",
>  		.of_match_table = adc5_match_table,
>  	},
>  	.probe = adc5_probe,
> +	.remove = adc5_exit,
>  };
>  module_platform_driver(adc5_driver);
>  

...

>  
> +static int qcom_vadc7_scale_hw_calib_die_temp(
> +				const struct vadc_prescale_ratio *prescale,
> +				const struct adc5_data *data,
> +				u16 adc_code, int *result_mdec)
> +{
> +
> +	int voltage, vtemp0, temp, i = 0;
> +
> +	voltage = qcom_vadc_scale_code_voltage_factor(adc_code,
> +				prescale, data, 1);
> +
> +	while (i < ARRAY_SIZE(adcmap7_die_temp)) {
> +		if (adcmap7_die_temp[i].x > voltage)
> +			break;
> +		i++;
> +	}

For loop (I think Andy also raised this one).

> +
> +	if (i == 0) {
> +		*result_mdec = DIE_TEMP_ADC7_SCALE_1;
> +	} else if (i == ARRAY_SIZE(adcmap7_die_temp)) {
> +		*result_mdec = DIE_TEMP_ADC7_MAX;
> +	} else {
> +		vtemp0 = adcmap7_die_temp[i-1].x;

Spaces around the - 
Same elsewhere.

> +		voltage = voltage - vtemp0;
> +		temp = div64_s64(voltage * DIE_TEMP_ADC7_SCALE_FACTOR,
> +			adcmap7_die_temp[i-1].y);
> +		temp += DIE_TEMP_ADC7_SCALE_1 + (DIE_TEMP_ADC7_SCALE_2 * (i-1));
> +		*result_mdec = temp;
> +	}
> +
> +	return 0;
> +}
> +
>  static int qcom_vadc_scale_hw_smb_temp(
>  				const struct vadc_prescale_ratio *prescale,
>  				const struct adc5_data *data,
...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ