Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755913Ab2HVFFa (ORCPT ); Wed, 22 Aug 2012 01:05:30 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:34104 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753091Ab2HVFF2 (ORCPT ); Wed, 22 Aug 2012 01:05:28 -0400 MIME-Version: 1.0 Date: Wed, 22 Aug 2012 10:35:27 +0530 Message-ID: Subject: Power: s3c_adc_battery.c backup battery query From: anish kumar To: linux-kernel@vger.kernel.org Cc: lars@metafoo.de, cbou@mail.ru, dwmw2@infradead.org, kzjeef@gmail.com, anarsoul@gmail.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1617 Lines: 41 Hello, I am trying to write a generic batttery driver using IIO and I have one some below questions: Why do we have the representation of backup battery in this driver(s3c_adc_battery.c) and when does the s3c_adc_backup_bat_get_property function gets called? As I understand, it is as this:It is called when it is registered and when the user wants to know the backup battery status(sysfs) and we don't do a workqueue scheduling as it will consume more power. static struct s3c_adc_bat backup_bat = { .psy = { .name = "backup-battery", .type = POWER_SUPPLY_TYPE_BATTERY, .properties = s3c_adc_backup_bat_props, .num_properties = ARRAY_SIZE(s3c_adc_backup_bat_props), .get_property = s3c_adc_backup_bat_get_property, .use_for_apm = 1, }, }; I am stuck with mulitple *get_property callbacks.As we don't know how many batteries system has and consequently we don't know how many *get_property callbacks to be implemented. So below is my plan: What I am trying to do is to have a single callback(*get_property) and manage everything in this callback and will use the name of the psy to distinguish between the different batteries which system has and driver will receive this information using platform data.Hope it makes sense. -- 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/