Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp221234lqp; Tue, 11 Jun 2024 02:26:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBWF2Ajb/eJmzKOFjMcyP3Nvo3n7XVliJ5MRJRt3uw3c2Euhx4sbUr1kg1oY9l+ArAM8YxqnhqWAgJ9LJY4pz52BASSuklUw20qnitLQ== X-Google-Smtp-Source: AGHT+IF5oTpQWcMJECGg7BWXdVAKrSFa+6pk13Sqe0grIzaNt86VCkVsadIVl6vuSfbmZOkHN8So X-Received: by 2002:a17:902:ce8c:b0:1f6:82e7:65c with SMTP id d9443c01a7336-1f6d02ddc39mr145791955ad.17.1718097977147; Tue, 11 Jun 2024 02:26:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718097977; cv=pass; d=google.com; s=arc-20160816; b=PvWugJjwS3M951Em2AGSqLP5Ltvt6VzfvhL0zX8n2K2jOiEyQ9GZkq1VWp4liLX8XY qwhyOnJLpcHHseyVRKeoteiVD530b2GOPzC9ac6t8VRbD8dCsMrQnIzU+RvtVxD0i/7+ JY8+pd8vf/ADjrW8cICF5iFbZVOXfCWPrPVJLiiCpvSIuTapd7nKSW9j6csZdYdi/xWG NFEKZRi/kWr06wIMDrWn/WgPlWAdAOZ+CscxlNa8HVxhGQXNmcXz760C2WoUxoWqGTp7 d35BtZhfXuMiNlVta2MN0zwTJfBOACN7G8rPUYgLDX0PXYm2QBvtuQeNCXBVrjyrVFtQ uyew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=KLRvrux7qnuomkpefvTqVWRMw/08JADT/EH5MpXik2s=; fh=/w6nb42D2KIOPAPZjNCPhUG9ExH9UawNp/2CpdnavnA=; b=tL8fLDit5Zt3NYc6mNDeEg/fxTGfF7/8TlLHr3E1kAz8MZdLWV3GPENLVNEut7UQwv AFxV/6dHnrPSdSsNGZwAATqW3iip8pRHxcAT6lqTma31kk6MYiKSDM/L+Z2BQrg4hgz9 SMnvTVkv5WZ3jdjW/XioyjDcft7GDujn5G/hfWicWWxFM1YoyCUJ+VnE10Xp0Er6VR5h CJtf7iWR1yOciZbJnz4s5KJAA5x+hbugAsLfI6wgWaHLHiyUv+VQKp/NyKv66eoRS480 eXIALULPeK7a7LoGYiULukk266WRvhMW17+9jKHQVCGbf/12/aztfGKrclSMySSMCXM2 QdWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UevoCbxA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-209561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6e5c77417si68576665ad.183.2024.06.11.02.26.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 02:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UevoCbxA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-209561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209561-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C31B4287EF9 for ; Tue, 11 Jun 2024 09:24:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C32F17B43E; Tue, 11 Jun 2024 09:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UevoCbxA" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6446176ADC for ; Tue, 11 Jun 2024 09:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718097695; cv=none; b=Pe7bXU9YLMLie5d/H9vX+SfqVz2cwVa5oZuOJyCV8ghdtGL18mjg77Y0eEuOytuRpIW66x1L80QYlebxUT7I36vdA+W8yAG14Hkm61TiIRibCbG0nzq7O8rcSMn/cr9djrkSRppsuOdHHt3sy+d01160xqFtu5U6J0cSiXmq7CI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718097695; c=relaxed/simple; bh=YDxxVy17GzQ25SND5tlc23Cufkpf/YLGDJ9a/s3A1+M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hcKDtebYSLc+ZBuPw7pJMKw1G4GdOtjROiAmQjOq1NPQvtPfESwV6DGV7Tq9v7wepoVXu4GBuRN212WeGcCAe7d5s2IVPDdJXTuQwTJNBIXQSRHhxb/o0NtExPFCzGPQXYMLGnlL9GT2zXD8LikKhuwwWdAHkxmkec3DgQBu8mk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UevoCbxA; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-421bb51d81aso6865695e9.3 for ; Tue, 11 Jun 2024 02:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718097692; x=1718702492; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=KLRvrux7qnuomkpefvTqVWRMw/08JADT/EH5MpXik2s=; b=UevoCbxACtUFwTnzm8S8+iQ5iyDq22jJMcX0J+S9NYRuXpKtXu4GDuKccwKxg42lWX T2znkLQhriivq/gsb9uE4j09LQN3BZFev2IHNHSrYErTX99dgjbNu6jFx3cfJkvzL7Xt JzMT1Eo74F+FDGVa0maerXhwOU6kOrFTUs4n2HL8qaEwpRfbGg6eb93+REyN5z0EDcN5 /C9AcZ4krI/vQokD3RpQlMHxUCmyw4MovOdgQFUXZWhOcAhCKGjcvK/OBLtAU/sxNHVZ Cw5cv3stmsSqUHvgD1mLIzmpGh+0Uw0R4o4Y6Zpq/67jaY/CAcTLgQLiO7CBTLYa6d7Z i22g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718097692; x=1718702492; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KLRvrux7qnuomkpefvTqVWRMw/08JADT/EH5MpXik2s=; b=HU6ty91KK+rVoJQNjkrx5ZR+n+cHIASXPQ3Ic+EPgPKY+gU+1sNU1LOHgK6g6cng5i KLM0Zv+W3ABIwIX0d0GE+DbjGEJnvLJOYcDGOB++ZoEBf1oberYL5i3Ez3IYMkj7cUhH hjS/h9SdZx4rdnGrwW5Lycv5BX84aoU9VIpHvTDrhekMdnoR8fuAi6Fw5ZAnuVWlhFvU 6RWLYtvLVdVwmbBJrIVyiS0HXW7w+VvJS9MfdByN/ScBFIkDERgtSs0v17UEceZ6Qbqb cCcpqIclWY6kGF0KHXzx94WNFcs8C02f3Dakj5Ai+2I3wlTTfqmho+S82sRb0Kt9SIF6 9vuw== X-Forwarded-Encrypted: i=1; AJvYcCXm2AUc3xvbHTMt2PqyAVG0jTzXnOQofZypvF4Das+bzvWZIeJB3bZQ6om7Jmq72S9NGpMrRElf5mvvRFTNrluE2fNho0Uj6QwWTv1L X-Gm-Message-State: AOJu0YyAII2oiZ08dV3vbx7hsk1HAJ+Ygk7X3nxnv6HsConzTk+o85tO lf3LDawnnt8gQ9t1027PaKwZ2gTP/f6hhZC58wn6cdYJWOlo352a0n+Sqsr3Reg= X-Received: by 2002:a05:600c:4e08:b0:421:c65a:738 with SMTP id 5b1f17b1804b1-421c65a0db9mr43755755e9.37.1718097692133; Tue, 11 Jun 2024 02:21:32 -0700 (PDT) Received: from [192.168.1.20] ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4217de88933sm104268215e9.44.2024.06.11.02.21.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 02:21:31 -0700 (PDT) Message-ID: Date: Tue, 11 Jun 2024 11:21:30 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2 2/2] leds: add mp3326 driver To: Yuxi Wang , pavel@ucw.cz, lee@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, wyx137120466@gmail.com Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240611083236.1609-1-Yuxi.Wang@monolithicpower.com> <20240611083236.1609-3-Yuxi.Wang@monolithicpower.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5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RGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20240611083236.1609-3-Yuxi.Wang@monolithicpower.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/06/2024 10:32, Yuxi Wang wrote: > This commit adds support for MPS MP3326 LED driver. Please do not use "This commit/patch/change", but imperative mood. See longer explanation here: https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 > > Signed-off-by: Yuxi Wang > > diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig > index d721b254e1e4..3ca7be35c834 100644 > --- a/drivers/leds/Kconfig > +++ b/drivers/leds/Kconfig > +/* > + * PWM in the range of [0 255] > + */ > +static int led_pwm_store(struct device *dev, struct device_attribute *attr, > + const char *buf, size_t count) Nope. ... > + } > + r_val = r_val * 255 / 4095 + (r_val * 255 % 4095) / (4095 / 2); > + g_val = g_val * 255 / 4095 + (g_val * 255 % 4095) / (4095 / 2); > + b_val = b_val * 255 / 4095 + (b_val * 255 % 4095) / (4095 / 2); > + if (led->num_colors == 1) > + return sysfs_emit(buf, "0x%x\n", r_val); > + else > + return sysfs_emit(buf, "0x%x 0x%x 0x%x\n", r_val, g_val, b_val); > +} > + > +static int led_enable_store(struct device *dev, > + struct device_attribute *attr, const char *buf, > + size_t count) Eeeee? store to enable LED? Really? ... > +{ > + struct led_classdev *lcdev = dev_get_drvdata(dev); > + struct mp3326_led *led = container_of(lcdev, struct mp3326_led, cdev); > + struct mp3326 *chip = led->private_data; > + int ret; > + uint val, i; > + > +static DEVICE_ATTR_RW(led_pwm); > +static DEVICE_ATTR_RW(led_enable); > +static DEVICE_ATTR_RO(led_short_fault); > +static DEVICE_ATTR_RO(led_open_fault); No, for multiple reasons: 1. Where ABI documentation? 2. There is a standard sysfs interface. No need for most of that. Please explain why standard interface does not fit your needs - for each new interface. > + > +static struct attribute *led_sysfs_attrs[] = { > + &dev_attr_led_pwm.attr, > + &dev_attr_led_enable.attr, > + &dev_attr_led_short_fault.attr, > + &dev_attr_led_open_fault.attr, > + NULL, > +}; > + > +ATTRIBUTE_GROUPS(led_sysfs); > + > +static int mp3326_add_led(struct mp3326 *chip, struct device_node *np, > + int index) > +{ > + struct mp3326_led *led = &chip->leds[index]; > + struct mc_subled *info; > + struct device_node *child; > + struct led_classdev *cdev; > + struct led_init_data init_data = {}; > + int ret; > + int i = 0; > + int count; > + u32 color = 0; > + u32 reg = 0; > + > + ret = of_property_read_u32(np, "color", &color); > + if (ret) { > + dev_err(&chip->client->dev, "Miss color in the node\n"); > + return ret; > + } Blank line > + led->private_data = chip; > + if (color == LED_COLOR_ID_RGB) { > + count = of_get_child_count(np); > + if (count != 3) { > + dev_err(&chip->client->dev, > + "RGB must have three node.\n"); > + return -EINVAL; > + } > + > + info = devm_kcalloc(&chip->client->dev, 3, sizeof(*info), > + GFP_KERNEL); > + if (!info) > + return -ENOMEM; > + > + for_each_available_child_of_node(np, child) { > + ret = of_property_read_u32(child, "reg", ®); > + if (ret || reg > MAX_CHANNEL) { > + dev_err(&chip->client->dev, > + "reg must less or equal than %d\n", > + MAX_CHANNEL); > + return -EINVAL; > + } > + > + ret = of_property_read_u32(child, "color", &color); > + if (ret) { > + dev_err(&chip->client->dev, > + "color must have value\n"); > + return ret; > + } > + > + if (color > 3 || !color) { > + dev_err(&chip->client->dev, > + "color must be Red, Green and Blue. The color is %d\n", > + color); > + return ret; > + } > + info[i].color_index = color; > + info[i].channel = reg; > + info[i].brightness = 0; > + i++; > + } > + > + led->subled_info = info; > + led->num_colors = 3; > + cdev = &led->cdev; > + cdev->max_brightness = MAX_BRIGHTNESS; > + cdev->brightness_set_blocking = led_brightness_set; > + cdev->groups = led_sysfs_groups; > + init_data.fwnode = &np->fwnode; > + > + ret = devm_led_classdev_register_ext(&chip->client->dev, > + &led->cdev, &init_data); > + > + if (ret) { > + dev_err(&chip->client->dev, > + "Unable register multicolor:%s\n", cdev->name); > + return ret; > + } > + } else { > + ret = of_property_read_u32(np, "reg", ®); > + if (ret || reg > MAX_CHANNEL) { > + dev_err(&chip->client->dev, > + "reg must less or equal than %d\n", > + MAX_CHANNEL); > + return -EINVAL; > + } > + info = devm_kcalloc(&chip->client->dev, 1, sizeof(*info), > + GFP_KERNEL); > + led->num_colors = 1; > + info[i].color_index = LED_COLOR_ID_WHITE; > + info[i].channel = reg; > + info[i].brightness = 0; > + led->subled_info = info; > + cdev = &led->cdev; > + cdev->max_brightness = MAX_BRIGHTNESS; > + cdev->brightness_set_blocking = led_brightness_set; > + cdev->groups = led_sysfs_groups; > + init_data.fwnode = &np->fwnode; > + ret = devm_led_classdev_register_ext(&chip->client->dev, > + &led->cdev, &init_data); > + if (ret) { > + dev_err(&chip->client->dev, "Unable register led:%s\n", > + cdev->name); > + return ret; > + } > + } Blank line > + return ret; > +} > + > +static int mp3326_parse_dt(struct mp3326 *chip) > +{ > + struct device_node *np = dev_of_node(&chip->client->dev); > + struct device_node *child; > + int ret; > + int i = 0; > + > + for_each_available_child_of_node(np, child) { > + ret = mp3326_add_led(chip, child, i); > + if (ret) > + return ret; > + i++; > + } > + > + ret = regmap_write(chip->regmap, MP3326_PWM_CTRL_CHANNEL_9_16, 0); > + if (ret) > + return ret; Blank line > + ret = regmap_write(chip->regmap, MP3326_PWM_CTRL_CHANNEL_1_8, 0); > + if (ret) > + return ret; Blank line > + return 0; > +} > + > +static int mp3326_leds_probe(struct i2c_client *client) > +{ > + struct mp3326 *chip; > + const struct reg_field *reg_fields; > + int count, i, j; > + > + count = device_get_child_node_count(&client->dev); > + if (!count) { Drop { Please run scripts/checkpatch.pl and fix reported warnings. Then please run `scripts/checkpatch.pl --strict` and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear. > + return dev_err_probe(&client->dev, -EINVAL, > + "Incorrect number of leds (%d)", count); > + } blank line > + chip = devm_kzalloc(&client->dev, struct_size(chip, leds, count), > + GFP_KERNEL); > + if (!chip) > + return -ENOMEM; > + > + chip->client = client; > + chip->num_of_leds = count; > + i2c_set_clientdata(client, chip); > + chip->regmap = devm_regmap_init_i2c(client, &MP3326_regmap_config); > + if (IS_ERR(chip->regmap)) > + return PTR_ERR(chip->regmap); > + > + for (i = 0; i < MAX_CHANNEL; i++) { > + reg_fields = channels_reg_fields[i]; > + for (j = 0; j < MAX_CTRL; j++) { > + chip->regmap_fields[i][j] = devm_regmap_field_alloc( > + &client->dev, chip->regmap, reg_fields[j]); > + if (IS_ERR(chip->regmap_fields[i][j])) > + return PTR_ERR(chip->regmap_fields[i][j]); > + } > + } Blank line > + if (mp3326_parse_dt(chip)) > + return 1; What is one? This looks like some sort of user-space or downstream approach. That's not how it works for upstream kernel. Do not introduce your downstream/user-space/other-system coding style and programming interface. You must use Linux approach. There is no way probe function returns a "1". See other files as example. > + else > + return 0; > +} > + > +static const struct i2c_device_id mp3326_id[] = { { "mp3326", 0 }, {} }; This must be formatted as kernel coding style. See other files as an example. > +MODULE_DEVICE_TABLE(i2c, mp3326_id); > + > +static const struct of_device_id mp3326_of_match[] = { { .compatible = > + "mps,mp3326" }, > + {} }; > +MODULE_DEVICE_TABLE(of, mp3326_of_match); > + > +static struct i2c_driver mp3326_driver = { > + .probe = mp3326_leds_probe, > + .driver = { > + .name = "mp3326_led", > + .of_match_table = mp3326_of_match, > + }, > + .id_table = mp3326_id, > +}; > + > +module_i2c_driver(mp3326_driver); > +MODULE_AUTHOR("Yuxi Wang "); > +MODULE_DESCRIPTION("MPS MP3326 LED driver"); > +MODULE_LICENSE("GPL"); Best regards, Krzysztof