~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/acpi/apei/erst.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
929
929
        return 0;
930
930
}
931
931
 
932
 
static size_t erst_reader(u64 *id, enum pstore_type_id *type,
 
932
static int erst_open_pstore(struct pstore_info *psi);
 
933
static int erst_close_pstore(struct pstore_info *psi);
 
934
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
933
935
                       struct timespec *time);
934
936
static u64 erst_writer(enum pstore_type_id type, size_t size);
935
937
 
936
938
static struct pstore_info erst_info = {
937
939
        .owner          = THIS_MODULE,
938
940
        .name           = "erst",
 
941
        .open           = erst_open_pstore,
 
942
        .close          = erst_close_pstore,
939
943
        .read           = erst_reader,
940
944
        .write          = erst_writer,
941
945
        .erase          = erst_clear
957
961
        char data[];
958
962
} __packed;
959
963
 
960
 
static size_t erst_reader(u64 *id, enum pstore_type_id *type,
 
964
static int reader_pos;
 
965
 
 
966
static int erst_open_pstore(struct pstore_info *psi)
 
967
{
 
968
        int rc;
 
969
 
 
970
        if (erst_disable)
 
971
                return -ENODEV;
 
972
 
 
973
        rc = erst_get_record_id_begin(&reader_pos);
 
974
 
 
975
        return rc;
 
976
}
 
977
 
 
978
static int erst_close_pstore(struct pstore_info *psi)
 
979
{
 
980
        erst_get_record_id_end();
 
981
 
 
982
        return 0;
 
983
}
 
984
 
 
985
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
961
986
                       struct timespec *time)
962
987
{
963
988
        int rc;
964
 
        ssize_t len;
965
 
        unsigned long flags;
 
989
        ssize_t len = 0;
966
990
        u64 record_id;
967
991
        struct cper_pstore_record *rcd = (struct cper_pstore_record *)
968
992
                                        (erst_info.buf - sizeof(*rcd));
970
994
        if (erst_disable)
971
995
                return -ENODEV;
972
996
 
973
 
        raw_spin_lock_irqsave(&erst_lock, flags);
974
997
skip:
975
 
        rc = __erst_get_next_record_id(&record_id);
976
 
        if (rc) {
977
 
                raw_spin_unlock_irqrestore(&erst_lock, flags);
978
 
                return rc;
979
 
        }
 
998
        rc = erst_get_record_id_next(&reader_pos, &record_id);
 
999
        if (rc)
 
1000
                goto out;
 
1001
 
980
1002
        /* no more record */
981
1003
        if (record_id == APEI_ERST_INVALID_RECORD_ID) {
982
 
                raw_spin_unlock_irqrestore(&erst_lock, flags);
983
 
                return 0;
 
1004
                rc = -1;
 
1005
                goto out;
984
1006
        }
985
1007
 
986
 
        len = __erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
987
 
                          erst_erange.size);
 
1008
        len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
 
1009
                        erst_info.bufsize);
 
1010
        /* The record may be cleared by others, try read next record */
 
1011
        if (len == -ENOENT)
 
1012
                goto skip;
 
1013
        else if (len < 0) {
 
1014
                rc = -1;
 
1015
                goto out;
 
1016
        }
988
1017
        if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0)
989
1018
                goto skip;
990
 
        raw_spin_unlock_irqrestore(&erst_lock, flags);
991
1019
 
992
1020
        *id = record_id;
993
1021
        if (uuid_le_cmp(rcd->sec_hdr.section_type,
1005
1033
                time->tv_sec = 0;
1006
1034
        time->tv_nsec = 0;
1007
1035
 
1008
 
        return len - sizeof(*rcd);
 
1036
out:
 
1037
        return (rc < 0) ? rc : (len - sizeof(*rcd));
1009
1038
}
1010
1039
 
1011
1040
static u64 erst_writer(enum pstore_type_id type, size_t size)