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]
Date:	Sat, 28 Aug 2010 21:40:55 +0530
From:	Sundar <sunder.svit@...il.com>
To:	Samu Onkalo <samu.p.onkalo@...ia.com>
Cc:	linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org
Subject: Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver

Hi Samu,

few minor comments,

On Fri, Aug 27, 2010 at 5:24 PM, Samu Onkalo <samu.p.onkalo@...ia.com> wrote:
> +
> +struct ak8974_chip {
> +       struct miscdevice       miscdev;
> +       struct mutex            lock;   /* Serialize access to chip */
> +       struct mutex            users_lock;
> +       struct i2c_client       *client;
> +       struct regulator_bulk_data regs[2];
> +       struct work_struct      work;
> +       wait_queue_head_t       misc_wait;
> +       loff_t                  offset;
> +
> +       int                     max_range;
> +       int                     users;
> +
> +       const char              *id;
> +       u8                      info[2];
> +
> +       s16                     x, y, z; /* Latest measurements */
> +       s8                      axis_x;
> +       s8                      axis_y;
> +       s8                      axis_z;
> +       bool                    valid;
> +
> +       char                    name[20];
> +};

This can be static ?

> +
> +       ak8974_regulators_off(chip);
> +

[..]

> +       if (err < 0) {
> +               dev_err(&chip->client->dev, "Device registration failed\n");
> +               goto fail3;
> +       }

[..]

> +       return 0;
> +fail4:
> +       misc_deregister(&chip->miscdev);
> +fail3:
> +       ak8974_regulators_off(chip);

in case of fail3, regulators get disabled twice. i think we will have
unbalanced calls to the supplies then.

> +
> +
> +#ifdef CONFIG_PM
> +static int ak8974_suspend(struct i2c_client *client, pm_message_t mesg)
> +{
> +       struct ak8974_chip *chip = i2c_get_clientdata(client);
> +       mutex_lock(&chip->users_lock);
> +       if (chip->users > 0)
> +               ak8974_enable(chip, AK8974_PWR_OFF);
> +       mutex_unlock(&chip->users_lock);
> +       return 0;
> +}

Can we disable the regulators here too?

Regards,
Sundar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ