Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755320Ab0KCNum (ORCPT ); Wed, 3 Nov 2010 09:50:42 -0400 Received: from mognix.dark-green.com ([88.116.226.179]:65377 "EHLO mognix.dark-green.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755169Ab0KCNuj (ORCPT ); Wed, 3 Nov 2010 09:50:39 -0400 MIME-Version: 1.0 Date: Wed, 03 Nov 2010 14:50:36 +0100 From: gimli To: Jiri Kosina Cc: Subject: Re: Resend [PATCH 3/4] MacbookAir3,1 and 3,2 hid support In-Reply-To: References: <66c1cd33ff5b2d908b2b31defb8e0cd1@mognix.dark-green.com> <3e6b335b371a07cd60221a25c5b6b47d@mognix.dark-green.com> Message-ID: <7b3b313ce7138c19191295a645dfb38f@mognix.dark-green.com> User-Agent: RoundCube Webmail/0.2.2 Content-Type: multipart/mixed; boundary="=_8dae06a25e1e099f76dbcc0b46649c1c" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10062 Lines: 157 --=_8dae06a25e1e099f76dbcc0b46649c1c Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="UTF-8" Does this look better ? I also use the USB id's for the if. On Wed, 3 Nov 2010 09:20:25 -0400 (EDT), Jiri Kosina wrote: > On Tue, 26 Oct 2010, gimli wrote: > >> This patch adds support for the new MacBookAir3,1 and 3,2 to the hid >> driver. >> >> Updated names names acording Apples kext. >> >> Signed-off-by: Edgar (gimli) Hucek > >> - trans = apple_find_translation((hid->product < 0x21d || >> + if(hid->product >= 0x023f && hid->product <= 0x0244 ) { >> + trans = >> apple_find_translation(macbookair_fn_keys, usage->code); >> + } else { >> + trans = apple_find_translation((hid->product < >> 0x21d || >> hid->product >= 0x300) ? >> powerbook_fn_keys : apple_fn_keys, >> usage->code); > > Could you please make this nicer? Having if and ternary operator both > there to chose the translation table looks really confusing. > > Thanks, --=_8dae06a25e1e099f76dbcc0b46649c1c Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="UTF-8"; name="hid_macbookair_1.patch"; Content-Disposition: attachment; filename="hid_macbookair_1.patch"; ZGlmZiAtdU5yIGxpbnV4LTIuNi4zNy1yYzEvZHJpdmVycy9oaWQvaGlkLWFwcGxlLmMgbGludXgt Mi42LjM3LXJjMS1NYWNCb29rQWlyL2RyaXZlcnMvaGlkL2hpZC1hcHBsZS5jCi0tLSBsaW51eC0y LjYuMzctcmMxL2RyaXZlcnMvaGlkL2hpZC1hcHBsZS5jCTIwMTAtMTEtMDMgMTQ6MzM6MzUuMDQ5 NjY2MDAwICswMTAwCisrKyBsaW51eC0yLjYuMzctcmMxLU1hY0Jvb2tBaXIvZHJpdmVycy9oaWQv aGlkLWFwcGxlLmMJMjAxMC0xMS0wMyAxNDozOToxMi40Nzk2NjYwMDEgKzAxMDAKQEAgLTU5LDYg KzU5LDI3IEBACiAJdTggZmxhZ3M7CiB9OwogCitzdGF0aWMgY29uc3Qgc3RydWN0IGFwcGxlX2tl eV90cmFuc2xhdGlvbiBtYWNib29rYWlyX2ZuX2tleXNbXSA9IHsKKwl7IEtFWV9CQUNLU1BBQ0Us IEtFWV9ERUxFVEUgfSwKKwl7IEtFWV9FTlRFUiwJS0VZX0lOU0VSVCB9LAorCXsgS0VZX0YxLAlL RVlfQlJJR0hUTkVTU0RPV04sIEFQUExFX0ZMQUdfRktFWSB9LAorCXsgS0VZX0YyLAlLRVlfQlJJ R0hUTkVTU1VQLCAgIEFQUExFX0ZMQUdfRktFWSB9LAorCXsgS0VZX0YzLAlLRVlfU0NBTEUsICAg ICAgICAgIEFQUExFX0ZMQUdfRktFWSB9LAorCXsgS0VZX0Y0LAlLRVlfREFTSEJPQVJELCAgICAg IEFQUExFX0ZMQUdfRktFWSB9LAorCXsgS0VZX0Y2LAlLRVlfUFJFVklPVVNTT05HLCAgIEFQUExF X0ZMQUdfRktFWSB9LAorCXsgS0VZX0Y3LAlLRVlfUExBWVBBVVNFLCAgICAgIE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k3LDEyIEBA CiAjZGVmaW5lIFVTQl9ERVZJQ0VfSURfQVBQTEVfV0VMTFNQUklORzNfQU5TSQkweDAyMzYKICNk ZWZpbmUgVVNCX0RFVklDRV9JRF9BUFBMRV9XRUxMU1BSSU5HM19JU08JMHgwMjM3CiAjZGVmaW5l IFVTQl9ERVZJQ0VfSURfQVBQTEVfV0VMTFNQUklORzNfSklTCTB4MDIzOAorI2RlZmluZSBVU0Jf REVWSUNFX0lEX0FQUExFX1dFTExTUFJJTkc0X0FOU0kJMHgwMjNmCisjZGVmaW5lIFVTQl9ERVZJ Q0VfSURfQVBQTEVfV0VMTFNQUklORzRfSVNPCTB4MDI0MAorI2RlZmluZSBVU0JfREVWSUNFX0lE X0FQUExFX1dFTExTUFJJTkc0X0pJUwkweDAyNDEKKyNkZWZpbmUgVVNCX0RFVklDRV9JRF9BUFBM RV9XRUxMU1BSSU5HNEFfQU5TSQkweDAyNDIKKyNkZWZpbmUgVVNCX0RFVklDRV9JRF9BUFBMRV9X RUxMU1BSSU5HNEFfSVNPCTB4MDI0MworI2RlZmluZSBVU0JfREVWSUNFX0lEX0FQUExFX1dFTExT UFJJTkc0QV9KSVMJMHgwMjQ0CiAjZGVmaW5lIFVTQl9ERVZJQ0VfSURfQVBQTEVfQUxVX1dJUkVM RVNTXzIwMDlfQU5TSSAgMHgwMjM5CiAjZGVmaW5lIFVTQl9ERVZJQ0VfSURfQVBQTEVfQUxVX1dJ UkVMRVNTXzIwMDlfSVNPICAgMHgwMjNhCiAjZGVmaW5lIFVTQl9ERVZJQ0VfSURfQVBQTEVfQUxV X1dJUkVMRVNTXzIwMDlfSklTICAgMHgwMjNiCg== --=_8dae06a25e1e099f76dbcc0b46649c1c-- -- 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/