Re: [PATCH] HID: roccat: Add support for Roccat Kone[+]

Jiri Kosina
2010-11-05T18:01:51Z

On Fri, 5 Nov 2010, Stefan Achatz wrote:

> > > This patch adds support for Roccat Kone[+] gaming mouse. Kone[+] is an enhanced version
> > > of the old Kone with more memory for macros, a better sensor and more functionality.
> > > This driver is conceptual similar to the existing Kone and Pyra drivers.
> > > Userland tools can soon be found at http://sourceforge.net/projects/roccat
> >
> > Seems like there is a lot of duplicate code with Roccat Kone.
> > Is there any reason this couldn't be merged with the Roccat Kone
> > counterparts?
>
> In fact the Kone[+] seems to be nearer to the Pyra than the old Kone.
> Looks like the manufacturer changed the firmware programmer between some
> devices. I wanted to wait until I see more devices of this manufacturer
> if some kind of genealogy might be visible and remove code duplication
> based on that.

It would be really nice, otherwise this gets into unmaintainable mess very
quickly.

> > > +static ssize_t koneplus_sysfs_read_profile5_settings(struct file *fp,
> > > + struct kobject *kobj, struct bin_attribute *attr, char *buf,
> > > + loff_t off, size_t count)
> > > +{
> > > + return koneplus_sysfs_read_profilex_settings(fp, kobj,
> > > + attr, buf, off, count, 4);
> > > +}
> > > +
> >
> > This is really ugly. Can't you have just one read() function and
> > distuingish according to bin_attribute->private?
>
> The patch comes in a view moments, if you like it I'll do the same for
> Kone and Pyra.

Would be nice, thanks for fixing it.

> > > + * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
> > > + */
> > > +
> > > +/*
> > > + * This program is free software; you can redistribute it and/or modify it
> > > + * under the terms of the GNU General Public License as published by the Free
> > > + * Software Foundation; either version 2 of the License, or (at your option)
> > > + * any later version.
> > > + */
> > > +
> > > +#include <linux/types.h>
> > > +
> > > +#pragma pack(push)
> > > +#pragma pack(1)
> >
> > Why?
>
> What?

I would prefer to have comments there, explaining why those pragmas are
necessary.

Thanks,

--
Jiri Kosina
SUSE Labs, Novell Inc.