Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934475AbbHKJsq (ORCPT ); Tue, 11 Aug 2015 05:48:46 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:54411 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965011AbbHKJji (ORCPT ); Tue, 11 Aug 2015 05:39:38 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-96-55c9c2d37728 From: Jacek Anaszewski To: linux-leds@vger.kernel.org Cc: linux-kernel@vger.kernel.org, cooloney@gmail.com, rpurdie@rpsys.net, stsp@users.sourceforge.net, Andrew Lunn , Nate Case , Jacek Anaszewski Subject: [PATCH/RFC v5 24/57] leds: pca955x: Remove work queue Date: Tue, 11 Aug 2015 11:37:37 +0200 Message-id: <1439285890-27329-25-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> References: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrELMWRmVeSWpSXmKPExsVy+t9jQd3Lh06GGkxu5LA4f/cQs8XRnROZ LHqvPme0uLxrDpvF1jfrGC2e9h9kt9i96ymrRWffNBYHDo+ds+6ye+zc8ZnJY8/8H6wefVtW MXo0nWpn9fi8Sc5jVfts1gD2KC6blNSczLLUIn27BK6Mi5P+sBSskq+4/X4jUwPjeckuRk4O CQETif93/7FA2GISF+6tZ+ti5OIQEpjFKPFiRTMjhPOTUeL/pSusIFVsAoYSP1+8Zupi5OAQ EZCT2HmmEiTMLHCRUaKvqRbEFhawk3jb/4YdpIRFQFViRX8KiMkr4ClxYX8qiCkhoCAxZ5IN SDEnUPT680WMILaQgIfE8dlNbBMYeRcwMqxilEgtSC4oTkrPNcxLLdcrTswtLs1L10vOz93E CA65Z1I7GA/ucj/EKMDBqMQDNP9kqBBrYllxZe4hRgkOZiUR3sKpQCHelMTKqtSi/Pii0pzU 4kOM0hwsSuK8shs2hwoJpCeWpGanphakFsFkmTg4pRoYSwtqvi61MzML6+xlTpQ+d0PCas3b /vxpzd+ZPrK7X5/Z2lPz50/8Bl6fO3/95p1hWLcutjch421hmX1kwWzbvVk9+yd8N3RYWHOU tW5amn2Hd7XOnFUtX0L/zF3Rf+TaiSX86a1vM++W3dQ/rpC4+FOF38VF/6MUZMrENv9aPP9t nLXRrTdnlViKMxINtZiLihMB+4vOXzUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4127 Lines: 133 From: Andrew Lunn Now the core implements the work queue, remove it from the drivers. Signed-off-by: Andrew Lunn Cc: Nate Case Signed-off-by: Jacek Anaszewski --- drivers/leds/leds-pca955x.c | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index b775e1e..32de9c6 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -47,7 +47,6 @@ #include #include #include -#include #include /* LED select registers determine the source that drives LED outputs */ @@ -110,8 +109,6 @@ struct pca955x { struct pca955x_led { struct pca955x *pca955x; - struct work_struct work; - enum led_brightness brightness; struct led_classdev led_cdev; int led_num; /* 0 .. 15 potentially */ char name[32]; @@ -193,7 +190,8 @@ static u8 pca955x_read_ls(struct i2c_client *client, int n) pca95xx_num_input_regs(pca955x->chipdef->bits) + 4 + n); } -static void pca955x_led_work(struct work_struct *work) +static void pca955x_led_set(struct led_classdev *led_cdev, + enum led_brightness value) { struct pca955x_led *pca955x_led; struct pca955x *pca955x; @@ -201,7 +199,7 @@ static void pca955x_led_work(struct work_struct *work) int chip_ls; /* which LSx to use (0-3 potentially) */ int ls_led; /* which set of bits within LSx to use (0-3) */ - pca955x_led = container_of(work, struct pca955x_led, work); + pca955x_led = container_of(led_cdev, struct pca955x_led, led_cdev); pca955x = pca955x_led->pca955x; chip_ls = pca955x_led->led_num / 4; @@ -211,7 +209,7 @@ static void pca955x_led_work(struct work_struct *work) ls = pca955x_read_ls(pca955x->client, chip_ls); - switch (pca955x_led->brightness) { + switch (value) { case LED_FULL: ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_LED_ON); break; @@ -230,7 +228,7 @@ static void pca955x_led_work(struct work_struct *work) * just turning off for all other values. */ pca955x_write_pwm(pca955x->client, 1, - 255 - pca955x_led->brightness); + 255 - value); ls = pca955x_ledsel(ls, ls_led, PCA955X_LS_BLINK1); break; } @@ -240,21 +238,6 @@ static void pca955x_led_work(struct work_struct *work) mutex_unlock(&pca955x->lock); } -static void pca955x_led_set(struct led_classdev *led_cdev, enum led_brightness value) -{ - struct pca955x_led *pca955x; - - pca955x = container_of(led_cdev, struct pca955x_led, led_cdev); - - pca955x->brightness = value; - - /* - * Must use workqueue for the actual I/O since I2C operations - * can sleep. - */ - schedule_work(&pca955x->work); -} - static int pca955x_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -329,8 +312,7 @@ static int pca955x_probe(struct i2c_client *client, pca955x_led->led_cdev.name = pca955x_led->name; pca955x_led->led_cdev.brightness_set = pca955x_led_set; - - INIT_WORK(&pca955x_led->work, pca955x_led_work); + pca955x_led->led_cdev.flags |= LED_BRIGHTNESS_BLOCKING; err = led_classdev_register(&client->dev, &pca955x_led->led_cdev); @@ -355,10 +337,8 @@ static int pca955x_probe(struct i2c_client *client, return 0; exit: - while (i--) { + while (i--) led_classdev_unregister(&pca955x->leds[i].led_cdev); - cancel_work_sync(&pca955x->leds[i].work); - } return err; } @@ -368,10 +348,8 @@ static int pca955x_remove(struct i2c_client *client) struct pca955x *pca955x = i2c_get_clientdata(client); int i; - for (i = 0; i < pca955x->chipdef->bits; i++) { + for (i = 0; i < pca955x->chipdef->bits; i++) led_classdev_unregister(&pca955x->leds[i].led_cdev); - cancel_work_sync(&pca955x->leds[i].work); - } return 0; } -- 1.7.9.5 -- 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/