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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 19 May 2012 02:43:52 +0400
From:	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
To:	Grant Likely <grant.likely@...retlab.ca>
Cc:	Linus Walleij <linus.walleij@...aro.org>,
	Linus Walleij <linus.walleij@...ricsson.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: add a driver for GPIO pins found on AMD-8111 south
 bridge chips

On Sat, May 19, 2012 at 2:35 AM, Grant Likely <grant.likely@...retlab.ca> wrote:
> On Fri, 27 Apr 2012 12:52:19 +0200, Linus Walleij <linus.walleij@...aro.org> wrote:
>> On Fri, Apr 27, 2012 at 12:08 PM, Dmitry Eremin-Solenikov
>> <dbaryshkov@...il.com> wrote:
>>
>> > Add a driver to use GPIO pins available on several AMD south bridges
>> > (currently only AMD 8111 is supported).
>> >
>> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
>>
>> Mainly nitpicks, it's looking good overall...
>
> Hi Dimtry,
>
> Do you have an updated version of this patch to address Linus' comments?

Colleagues,

I was a little bit busy with job & private topics. I plan to post
updated version
either during the weekend, or on Mon-Wed.

>
> g.
>
>>
>> > +       spin_lock_irqsave(&agp->lock, flags);
>> > +       temp = ioread8(agp->pm - PMBASE_OFFSET + PMBASE_GPIO(offset));
>> > +       temp = (temp & 0x1c) | (!!value);
>>
>> This is a bit idomatic but I think I understand what's going on. However this
>> 0x1C magic could be better of with some #define AMD_8111_GPIO_FOO don't
>> you think?
>>
>> > +static int amd_gpio_get(struct gpio_chip *chip, unsigned offset)
>> > +{
>> > +       struct amd_gpio *agp = to_agp(chip);
>> > +       u8 temp;
>> > +
>> > +       temp = ioread8(agp->pm - PMBASE_OFFSET + PMBASE_GPIO(offset));
>> > +
>> > +       dev_dbg(&agp->pdev->dev, "Getting gpio %d, reg=%02x\n", offset, temp);
>> > +
>> > +       return !!(temp & 0x20);
>>
>> And this could be #define AMD_8111_GPIO_INVAL or so (I bet this bit has a
>> name in the datasheet, right?)
>>
>> > +static int amd_gpio_dirout(struct gpio_chip *chip, unsigned offset, int value)
>> > +{
>> > +       struct amd_gpio *agp = to_agp(chip);
>> > +       u8 temp;
>> > +       unsigned long flags;
>> > +
>> > +       spin_lock_irqsave(&agp->lock, flags);
>> > +       temp = ioread8(agp->pm - PMBASE_OFFSET + PMBASE_GPIO(offset));
>> > +       temp = (temp & 0x10) | 0x4 | (!!value);
>>
>> And so on...
>>
>> > +       iowrite8(temp, agp->pm - PMBASE_OFFSET + PMBASE_GPIO(offset));
>> > +       spin_unlock_irqrestore(&agp->lock, flags);
>> > +
>> > +       dev_dbg(&agp->pdev->dev, "Dirout gpio %d, value %d, reg=%02x\n", offset, !!value, temp);
>> > +
>> > +       return 0;
>> > +}
>>
>> > +static int __init mod_init(void)
>>
>> amd_gpio_init() maybe? These names are nice for e.g. ftrace.
>>
>> > +       printk(KERN_INFO "AMD-8111 GPIO detected\n");
>>
>> pr_info() & friends are nice shorthands for this.
>>
>> > +static void __exit mod_exit(void)
>>
>> amd_gpio_mod_exit()?
>>
>> > +MODULE_AUTHOR("The Linux Kernel team");
>>
>> Don't be shy, put in your own name :-)
>>
>> Yours,
>> Linus Walleij
>
> --
> Grant Likely, B.Sc, P.Eng.
> Secret Lab Technologies, Ltd.



-- 
With best wishes
Dmitry
--
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